ePages 7.0.0 - DE_EPAGES/PayPalExpress/API/Payment.pm

Package DE_EPAGES::PayPalExpress::API::Payment

Payment functions for PayPal Express.

@EXPORT_OK
CheckoutRequest
CheckoutRequestDetails
DoCheckoutPayment
RefundTransaction
SendPayPalRequest
TestPPSettings
GetInstantUpdateParams
ResetBasket

Functions

CheckoutRequest
CheckoutRequestDetails
DoCheckoutPayment
GetInstantUpdateParams
RefundTransaction
ResetBasket
SendPayPalRequest
TestPPSettings

CheckoutRequest

calls SetExpressCheckout

Syntax
CheckoutRequest($LineItem, \%Params);
Input
$LineItemPaymentPayPalExpress (object)
the payment lineitem
$hInfo (ref.hash)
data for SetExpressCheckout request:
  • ObjectID - basket id - int
  • LocaleCode - locale code (2 char country code) - string
  • BuyerEmail - email of buyer - string
  • ReturnURL - return url - string
  • CancelURL - cancel url - string
  • BUTTONSOURCE - build notation id followed by 'S' (express) or 'M' (normal) - string

Return
$redirectUrl (string)
redirect url with token from response

CheckoutRequestDetails

calls GetExpressCheckoutDetails

Syntax
CheckoutRequestDetails($LineItem, \%Params);
Input
$LineItemPaymentPayPalExpress (object)
the payment lineitem
$hInfo (ref.hash)
data for GetExpressCheckoutDetails request:
  • ObjectID - basket/order id - int

Return
$details (ref.hash)
the response details

DoCheckoutPayment

calls DoExpressCheckoutPayment

Syntax
DoCheckoutPayment($LineItem, \%Params);
Input
$LineItemPaymentPayPalExpress (object)
the payment lineitem
$hInfo (ref.hash)
data for DoExpressCheckoutPayment request:
  • ObjectID - order id - int

Return
$payinfo (ref.hash)
the response payment info

GetInstantUpdateParams

fetches the params for the Instant Update API used in the SetExpressCheckout request and CallbackResponse, see PayPalExpress::API::Payment::CheckoutRequest and PayPalExpress::UI::Basket::PayPalExpressCallback

Syntax
GetInstantUpdateParams($Container);
Input
$Container (object)
the container object
Return
$hParams (ref.hash)
the response details

RefundTransaction

calls RefundTransaction

Syntax
RefundTransaction($LineItem, \%Params);
Input
$LineItemPaymentPayPalExpress (object)
the payment lineitem
$amount (float)
the amount to refund (optional); if omitted refund whole amount
$note (string)
note to send to PayPal (optional)
Return
$success (boolean)
successful?
$hResult (ref.hash)
response of RefundTransaction call

ResetBasket

Deletes any address of a anonymous basket user, set the payment line item to the default payment method

Syntax
ResetBasket($Basket);
Input
$Basket (object)
basket object

SendPayPalRequest

sends a request with name/value pairs as parameters to PayPal

Syntax
my $hResult = SendPayPalRequest($PaymentMethod, \%Params);
Input
$PaymentMethod (object)
the payment method
$hParams (ref.hash)
name/value input parameter hash for PayPal request
Return
$hResponse (ref.hash or undef)
response hash from PayPal; undef if an error occurs

TestPPSettings

tests the settings of the payment method by calling SetExpressCheckout

Syntax
my $hResult = TestPPSettings($PaymentMethod);
Input
$PaymentMethod (object)
the payment method
$hParams (ref.hash (optional))
parameter hash
Return
$hResult (ref.hash)
result from PayPal, may be undef on failure