I have already created Paypal/Developer/Sandbox Account. Already got API Credentials.
Downloaded PHP SDK http://paypal.github.io/PayPal-PHP-SDK/
Referring: https://developer.paypal.com/docs/api/
https://devtools-paypal.com/guide/expresscheckout/php?interactive=ON&env=sandbox
I have already done Sandbox One Transaction with Authorize Method using my PHP Script.
What i have to achieve. I need to get Authorize Payments, Convert "Authorize" payments to "Capture/Sale" Method & Notify Customer & Admin As well.
How to get Authorization Id?
By referring above document i need to use 3 Web Services
Already have Transaction ID of "Authorize" Payment.
Please provide the steps to follow & if any example already available then please share
Need to integrate this functionality in Magento 2
[UPDATE]
I have changed my API Sandbox Credentials in PHP SDK in PayPal-PHP-SDK-master\sample\bootstrap.php
file.
From sample/payments/AuthorizePayment.php
i will get Authorized Payment with ID: PAY-0TV39791XXX02404VK7XD32I & it works fine.
When i input my Transaction Id
it gives
{"name":"INVALID_RESOURCE_ID","message":"Requested resource ID was not found.","information_link":"https://developer.paypal.com/webapps/developer/docs/api/#INVALID_RESOURCE_ID","debug_id":"1f2b08ce88633"}
My Sandbox Transaction Id is 3AA32794KF48247AA
. So question is how to convert your Transaction Id in to Payment Id?
https://magento.stackexchange.com/questions/138579/magento-2-change-paypal-action-method-on-the-fly
Below is the reply from Paypal
Transaction id can be generated after REST API execute payment, Classic API [NVP/SOAP] DoEC API or normal button payment completion. It will never work to reverse the search to find the Payment Id.
If you have paymentId, you can get details of authorized payment in this way:
$payment = Payment::get( $paymentId, $apiContext );
For all propeties of payment class take a look this - Payment.php
To change Sandbox/API Credentials edit the bootstrap.php in your project.
UPDATE
You don't need to use AuthorizePayment.php. Istead, do the following:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With