I am unable to get the transactions id from paypal ExpressCheckout method.
$provider = new ExpressCheckout;
$response = $provider->getExpressCheckoutDetails($request->token);
echo "<pre>";print_r($response);
Array
(
[TOKEN] => EC-79454119W8713794B
[BILLINGAGREEMENTACCEPTEDSTATUS] => 1
[CHECKOUTSTATUS] => PaymentActionNotInitiated
[TIMESTAMP] => 2021-11-01T04:14:23Z
[CORRELATIONID] => f00ab9c2819b4
[ACK] => Success
[VERSION] => 123
[BUILD] => 55938276
[EMAIL] => [email protected]
[PAYERID] => 238MG2US77AQY
[PAYERSTATUS] => unverified
[FIRSTNAME] => john
[LASTNAME] => doe
[COUNTRYCODE] => US
[ADDRESSSTATUS] => Confirmed
[CURRENCYCODE] => USD
[AMT] => 24.99
[ITEMAMT] => 24.99
[SHIPPINGAMT] => 0.00
[HANDLINGAMT] => 0.00
[TAXAMT] => 0.00
[DESC] => Order #61 Invoice
[INVNUM] => 61
[NOTIFYURL] => https://example.com/ipn/notify
[INSURANCEAMT] => 0.00
[SHIPDISCAMT] => 0.00
[INSURANCEOPTIONOFFERED] => false
[L_NAME0] => Monthly Unlimited
[L_QTY0] => 1
[L_TAXAMT0] => 0.00
[L_AMT0] => 24.99
[PAYMENTREQUEST_0_CURRENCYCODE] => USD
[PAYMENTREQUEST_0_AMT] => 24.99
[PAYMENTREQUEST_0_ITEMAMT] => 24.99
[PAYMENTREQUEST_0_SHIPPINGAMT] => 0.00
[PAYMENTREQUEST_0_HANDLINGAMT] => 0.00
[PAYMENTREQUEST_0_TAXAMT] => 0.00
[PAYMENTREQUEST_0_DESC] => Order #61 Invoice
[PAYMENTREQUEST_0_INVNUM] => 61
[PAYMENTREQUEST_0_NOTIFYURL] => https://example.com/ipn/notify
[PAYMENTREQUEST_0_INSURANCEAMT] => 0.00
[PAYMENTREQUEST_0_SHIPDISCAMT] => 0.00
[PAYMENTREQUEST_0_SELLERPAYPALACCOUNTID] => [email protected]
[PAYMENTREQUEST_0_INSURANCEOPTIONOFFERED] => false
[L_PAYMENTREQUEST_0_NAME0] => Monthly Unlimited
[L_PAYMENTREQUEST_0_QTY0] => 1
[L_PAYMENTREQUEST_0_TAXAMT0] => 0.00
[L_PAYMENTREQUEST_0_AMT0] => 24.99
[PAYMENTREQUESTINFO_0_ERRORCODE] => 0
)
I need transaction id for making refund. that's why I need transaction id. This is the function I am trying for refund
$response = $provider->refundTransaction($transactionid);
CodePudding user response:
using getExpressCheckout - wont give you the transaction ID
you will be getting transaction id from the doExpressCheckout API in the response.
Then persist / store this transaction id and later you can do the refund process.
- If you didnot store the transaction id, then using Invoice Number you can consume the api Transaction Search API https://developer.paypal.com/docs/nvp-soap-api/transaction-search-nvp/#transactionsearch-response-message. It has multiple params (search option), so you will get the transaction id.
But PayPal recommends to go with Option 1 . Store the transacton id and go for further refund process (instead of search api)
CodePudding user response:
You will get it after you perform the DoExpressCheckoutPayment API call. Before that, I don't think you can get transaction ID. YOu will get response like: doExpressCheckoutPayment:
Array
(
[TOKEN] => EC-2FR88291S31672645
[SUCCESSPAGEREDIRECTREQUESTED] => false
[TIMESTAMP] => 2012-02-24T10:26:08Z
[CORRELATIONID] => a95c7a9bb64b3
[ACK] => Success
[VERSION] => 84
[BUILD] => 2571254
[INSURANCEOPTIONSELECTED] => false
[SHIPPINGOPTIONISDEFAULT] => false
[PAYMENTINFO_0_TRANSACTIONID] => 2RN165632T770592L
[PAYMENTINFO_0_TRANSACTIONTYPE] => expresscheckout
[PAYMENTINFO_0_PAYMENTTYPE] => instant
[PAYMENTINFO_0_ORDERTIME] => 2012-02-24T10:26:06Z
[PAYMENTINFO_0_AMT] => 10.00
[PAYMENTINFO_0_TAXAMT] => 0.00
[PAYMENTINFO_0_CURRENCYCODE] => GBP
[PAYMENTINFO_0_PAYMENTSTATUS] => Pending
[PAYMENTINFO_0_PENDINGREASON] => authorization
[PAYMENTINFO_0_REASONCODE] => None
[PAYMENTINFO_0_PROTECTIONELIGIBILITY] => Eligible
[PAYMENTINFO_0_PROTECTIONELIGIBILITYTYPE] => ItemNotReceivedEligible,UnauthorizedPaymentEligible
[PAYMENTINFO_0_SECUREMERCHANTACCOUNTID] => WLC8CZSP2C5L8
[PAYMENTINFO_0_ERRORCODE] => 0
[PAYMENTINFO_0_ACK] => Success
)