PayPal Recurring Payment Issue
We have a cart plugin called SmartPayCart.com and we're trying to implement 1-click upsells with PayPal but running into issues with it. Here is the flow we are using.
Main product is a recurring product.
Say main product is Product A. It's a monthly subscription product @ $10/month. Users visit the checkout page and click on the 'checkout with PayPal' button. These are the call we are making to PayPal but it's not working right.
Set up the payment authorization
Step 1. SetExpressCheckout
We call SetExpressCheckout with L_BILLINGTYPE set to MerchantInitiatedBilling .
Set return URL to a php script on our site.
Request:
&L_BILLINGTYPE0=MerchantInitiatedBilling
&L_PAYMENTTYPE0=Any
&L_BILLINGAGREEMENTDESCRIPTION0=ProductA
&RETURNURL=returnUrl
&CANCELURL=cancelUrl
&SOLUTIONTYPE=Sole
Response:
In the response, we get back a token.
Step 2. Redirect the buyer to PayPal
Next we redirect buyer to PayPal and append the token returned by SetExpressCheckout.
Request:
https://www.sandbox.paypal.com/cgi-bin/webscr?cmd=_express-checkout&token=InsertTokenHere
Step 3: Create the billing agreement
If the buyer authorizes the payment, they are redirected to the return URL specified in the SetExpressCheckout call (step 1) with the appended token.
Request: Next we call In CreateBillAgreement with the URL-decoded token.
Response: The CreateBillAgreement returns a billing agreement ID - BILLINGAGREEMENTID. We save this billing agreement id so it can be used to implement
1-click upsell flow.
The billing agreement id is only for upsell flow. Not used for main purchase.
Step 4: Capture the current purchase
Next we call DoExpressCheckoutPayment to capture the current purchase.
We pass the token (that we get from step 1) in this call.
This returns a success message and transaction id.
Step 5: Now we call CreateRecurringProfile method.
In this method we send the token that we got in step 1 and we send the billing details (cycle, period, frequency, etc) for the recurring payment (main product is a recurring product).
NOT WORKING:
The recurring profile is not getting created in PayPal. It's returning this error message:
A successful Billing Agreement has already been created for this token.
And this is just for the main product.
We're still stuck on this one and have not been able to test the upsell flow.
What are we doing wrong? Why is it returning this message and why is it not creating a recurring profile in PayPal?
Also, say that user completes purchase of product A and is now redirected to an upsell page where we sell product B (also a subscription product ). How do we make sure that the upsell flow is 1-click and users are not required to confirm or login again?
What's the next step after this to support 1-click upsell flow for other subscription products? The documentation you guys have on this is not very helpful. Look forward to your feedback.
Build Productive Habits
Traffic & Conversions
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed duius eiusmod tempor incididunt ut labore et dolore magna prior consequat laboris aliqua.