Reputation: 21
I`m building an application using Laravel with Paypal PHP SDK, and everything was working normally, but today when I wanted to make some tests on checkout, I faced some errors, Paypal securely login stopped working, and as I checked, it seems that Paypal PHP SDK Link is now deprecated, and we have to use new SDK for API V2 Link.
I downloaded the new PHP SDK, but from the documentation, they only provided sample on how to create an Order with the SDK, and no sample provided for creating Payments.
My first question, what is the difference between Order V2 and Payment V2? Question number 2, is there any example for how to create payment with the new PHP SDK? because I need to make the user able to click on purchase button and pay with Paypal with PHP.
Upvotes: 0
Views: 4244
Reputation: 30359
The v2 SDK uses Orders for the payment approval process (instead of PAYIDs). 'v2 Payments' refer to what you get when you capture/authorize an order i.e. transaction/authorization objects.
The way you create a 'Payment' in v2 most simply is you first create an order with intent:capture, and you pass that orderid to the front-end UI https://developer.paypal.com/demo/checkout/#/pattern/server , and after approval you capture it (equivalent to v1 execute).
Capture results in a capture id, which is a v2 payment object (equivalent to a v1 sale id). This id is what will show in paypal.com account, and the only thing you need to persist for accounting purposes.
The changes can seem confusing at first, but the new system is better.
Upvotes: 1