简体   繁体   中英

How to make monthly subscription payments with paypal php rest api

I want to make monthly subscription payment with paypal php rest api. Is it possible with rest api. If yes then please describe how can I achieve that. Also after successful subscription how can I cancel the subscription via Api. Also how can update the DB if subscription payment is failed.

It's possible to create a subscription payment with the Paypal API.

First of all you need to create a product with the catalogue api: https://developer.paypal.com/docs/api/catalog-products/v1/#products_create

You have to create a product regardless what you are selling (physical goods or services)

The you will use the subscriptions api to create plans that are linked to the created product: https://developer.paypal.com/docs/api/subscriptions/v1/#plans_create

Obviously a product can have multiple plans with different pricing or billing cycle

Finally you can integrate the Smart Payment buttons to your checkout form to allow users to subscribe to a plan: https://developer.paypal.com/docs/subscriptions/integrate/#4-create-a-subscription

You can read the currently complete guide of paypal subscription integration here: https://developer.paypal.com/docs/subscriptions/integrate/

After a subscription is created it can be canceled via the subscription api: https://developer.paypal.com/docs/api/subscriptions/v1/#subscriptions_cancel

I don't remember how to create the recurring payment with Paypal, but as far as I know, canceling it is not possible via their api.

On our website, we have to tell the users to cancel their subscription on paypal's website.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM