How to make monthly subscription payments with paypal php rest api - php

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.

Related

How to add Paypal IPN into my website for getting subscription status after few days

I am creating recurring payment using paypal and want the status of the payment after few days.I mean i want to check user is still subscribe us or cancel the subscription. if he/she cancel the subscription or i want to update his status into my website.
Can you anyone help me out please.
Thank you.
If you are using Standard subscriptions or NVP/SOAP recurring payments APIs when you will get an IPN when the profile is canceled, so you can automate the processing of that. In the case of recurring payments APIs you could also use GetRecurringPaymentsProfileDetails any time you want to check the status.
If you are using REST API billing agreements / billing plans then you can use Webhooks, which are similar to IPN. You could also use GET to pull plan details.

How to know when PayPal recurring payment fired?

I'm using new PayPal REST API to manage users recurring payments. When i create recurring profile i provide return_url and cancel_url. But how do i know if scheduled payment succeeded or failed so i can prolong or cancel user profile in my application? I know there is IPN but it should be used with old Classic API.
Take a look at Instant Payment Notification. It will allow you to automate tasks based on all sorts of transactions on your account, including new subscription profiles and payments related to them.

Manage Payment Flow Through Php Api

i had done simple payment and reccuring payment in paypal using php..but now i want do payment like ebay system..i want manage seller account,middle patry account,buyer account. when buyer order for any product that time money tranfer from buyer account to middle party account and when buyer got product at that time money tranfer from middle party to seller account..i want make this system using php..i tried for create customer and add charge in stripe..but i dont know how to deduct charge from middle party in stripe php api
You can check the whole Stripe API available for PHP at this link and check what meets your needs:
https://stripe.com/docs/api?lang=php#intro

PayPal Sandbox | Express checkout allow credit card payments

First of all a want to mention that I am very new in PayPal at all.
I have create a plugin for WordPress, that is useful for booking a taxi for a trip. The plugin, it has it's own cart, that allowing the client to add several services in the cart and then to check out via PayPal.
As I mentioned earlier I am new, to PayPal, so I have download the PHP SDK provided by the PayPal, and I have complete the first step of the payment process. I have got the Token, and then redirect my client to PayPal web site to perform the payment.
The problem is that, in PayPal web site I have only the options "Have a PayPal account?" and "Create a PayPal account". What I like to ask, is how can I use the credit card payment instead of the "Create a PayPal account" ? Is there any way ?
Any idea please ?
You may want to try using Stripe. http://www.stripe.com/ super-easy, and has excellent documentation. I have used it alongside Paypal express checkout.
Paypal now required paypal account to get payment when you use express checkout api, to get payment from paypal use credit card reference api or any other api suit your need from paypal

Several questions about paypal pro subscriptions flow

I have integrated standard paypal with one of sites and it works as follows: user selects which subscription to buy, he is redirected to paypal, paypal sends IPN response, I process it and then every X days PayPal sends a new IPN notifying site that user has been successfully charged for new subscription iteration. Now the problem is that user needs to have paypal account to sign up for such subscription.
The customer contacted PayPal and found out that it is possible to avoid having user to use their PayPal account to buy subscription when seller uses paypal pro account. Is it really so? Will I be able to gather user's card info, then send some request to PayPal API and have the subscription created. If yes, what will happen next? PayPal will be sending me IPN requests every X days notifying site that the card has been successfully charged?
Also, what is the general flow? Do I always have to gather card info and send it to paypal api or can I redirect user to paypal in a similar way as standard paypal functions?
Yes, this is possible. You would need to sign up for PayPal Website Payments Pro and Direct Payment Recurring Payments. You can then use the CreateRecurringPaymentsProfile API and specify the card details directly in a single API call.
This will create a recurring profile, which is billed every X days / months, depending on what you specified as the billing period in CreateRecurringPaymentsProfile.
Alternatively, you can also sign up for PayPal Premium Services (for the UK) or PayPal Enhanced Recurring Payments (for the US). This allows you to accept subscription payments from guest users, using the exact same integration you have at the moment, except a 'guest payment' section will be added to the PayPal checkout screen, so buyers won't be forced to create a PayPal account to sign up for your subscriptions any longer.
(Note: Enhanced Recurring Payments / Premium Services has other benefits as well, such as Installment Plans, but guest subscription payments is definitely the biggest benefit).

Categories