Paypal Smart Subscribe Server Side

PayPal Smart Subscribe server side

I'm not aware of a demo sample, but the createSubscription portion can be be done via this API call: https://developer.paypal.com/docs/api/subscriptions/v1/#subscriptions_create

For subscriptions, by default the subscription will be activated automatically on approval, before onApprove is called.

You can set the application_context -> user_action to something other than SUBSCRIBE_NOW if you want to show a review step and activate with an API call.

PayPal Smart Payment Buttons integration with server-side REST API

You are looking for this front-end: https://developer.paypal.com/demo/checkout/#/pattern/server

For your backend, you should use the latest v2/orders SDK: https://github.com/paypal/Checkout-PHP-SDK

(Your v1/payments backend will work, but that SDK is deprecated and there is no reason to use it for a new integration)

PayPal Smart Button server side implementation - Problems with capturing transaction - PHP

This is your problem line:

CaptureOrder::captureOrder('$orderId', true);

You are literally sending the text string inside the single quotes: '$orderId' to PayPal. The $ and those 7 letters are going to PayPal. You are not sending the contents of your $orderId variable.

Get rid of your string quotes:

CaptureOrder::captureOrder($orderId, true);

By the way, a detail about PHP (and incidentally, shell languages like bash) you may not be aware of:

Note: Unlike the double-quoted and heredoc syntaxes, variables and escape sequences for special characters will not be expanded when they occur in single quoted strings.

ref: https://www.php.net/manual/en/language.types.string.php#language.types.string.parsing

Basically, double quotes and single quotes behave differently in this respect.



Related Topics



Leave a reply



Submit