- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am trying to test a button to create a subscription. Here is the flow and the data:
- In the sandbox dashboard, I created a sandbox app and a business and personal account. I went into the sandbox business account and created a product and a subscription plan... so I have a valid and active plan_id.
- I am creating a ReactJS JSX web app. In my page component, I am loading the sdk via a promise method:
let sdkUrl = "https://www.paypal.com/sdk/js?client-id=MY_SANDBOX_CLIENT_ID&vault=true"
const script = document.createElement('script');
script.type = "text/javascript";
script.src=src;
script.addEventListener('load', resolve);
script.addEventListener('error', reject);
document.head.appendChild(script)
- In the render method of my component, assuming the script has successfully loaded, I render the following button:
let PayPalButton = window.paypal.Buttons.driver("react", {React, ReactDOM});
<PayPalButton
createSubscription={(data, actions) => actions.subscription.create({'plan_id': "P-91C68062SP676092ALZDUTTY"})}
onApprove={(data, actions) => actions.subscription.get().then(details => console.log("onApprove:", data))}
onSuccess={(data, actions) => actions.subscription.get().then(details => console.log("onSuccess:", data))}
catchError={err => actions.subscription.get().then(details => console.log("catchError:", err))}
onError={err => actions.subscription.get().then(details => console.log("onError:", err))}
onShippingChange={(data, actions) => actions.subscription.get().then(details => console.log("onShippingChange:", data))}
onCancel={data => actions.subscription.get().then(details => console.log("onCancel:", data))}
/>
- I run the webpage and the button appears exactly as it should. I click the button and the PayPal checkout dialog appears asking me to login:
- I log in using my "personal" sandbox account that I created. Immediately upon clicking "Log In" I see the following:
- At this point, the dialog is stuck and never progresses. The dialog url at this point is as follows:
/*
https://www.sandbox.paypal.com/checkoutnow?sessionID=012099b64e_mty6mde6mjm&buttonSessionID=5c387d19bf_mty6mde6mjg&fundingSource=paypal&buyerCountry=CA&locale.x=en_US&commit=true&clientID=AbWTlgcsukRa6ihm3dz5afywmp-d0WZOq1qPYYkCO9oB4-rQ1W2pz-mBsOFhHkWkWreYjfHHLbbUcOgM&env=sandbox&sdkMeta=eyJ1cmwiOiJodHRwczovL3d3dy5wYXlwYWwuY29tL3Nkay9qcz9jbGllbnQtaWQ9QWJXVGxnY3N1a1JhNmlobTNkejVhZnl3bXAtZDBXWk9xMXFQWVlrQ085b0I0LXJRMVcycHotbUJzT0ZoSGtXa1dyZVlqZkhITGJiVWNPZ00mdmF1bHQ9dHJ1ZSIsInN0YWdlSG9zdCI6bnVsbCwiYXBpU3RhZ2VIb3N0IjpudWxsfQ&xcomponent=1&version=5.0.104&token=7K52873721966951E&arc=1#/checkout/genericError?code=UkVUUlk%3D
*/
Now, since this is the sandbox environment, I decided to test it using a live account. I had a friend enter his PayPal credentials and after clicking login, it successfully showed the "choose a payment method" screen. I did not proceed any further as I did not want to actually charge my friends account.
It appears to be a sandbox only issue - but I really really want to test my PayPal button from start to finish to make sure everything is working, but I don't have the resources to test using a live account.
Anyone have any ideas as to what is going on?
Solved! Go to Solution.
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
After talking to technical support, I was actually able to reproduce the problem using the demo checkout page. They looked into it and came back and told me that the onShippingChange method is actually not supported for subscriptions and the solution was to simply remove onShippingChange from the button properties and everything started working just fine.
Since I didn't actually need that method it was the solution for me. Anyone that does need to process shipping address changes with a subscription, well, sorry... it appears that it will not work.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
Thank you for posting on the PayPal Merchant Technical Support Community.
I was looking at your code and it almost seems that the shipping address change may be holding up your integration in Sandbox.
onShippingChange={(data, actions) => actions.subscription.get().then(details => console.log("onShippingChange:", data))}
Is there a way for you to see if your console is logging any error messages that is causing the loading screen in PayPal?
Usually you only see loading if there is an error message in the console that is hanging the page up.
It possible in the live environment there is no shipping address changes happening so its not spinning.
Thank you,
Jennifer
PayPal
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
After talking to technical support, I was actually able to reproduce the problem using the demo checkout page. They looked into it and came back and told me that the onShippingChange method is actually not supported for subscriptions and the solution was to simply remove onShippingChange from the button properties and everything started working just fine.
Since I didn't actually need that method it was the solution for me. Anyone that does need to process shipping address changes with a subscription, well, sorry... it appears that it will not work.
Haven't Found your Answer?
It happens. Hit the "Login to Ask the community" button to create a question for the PayPal community.
- Something went wrong. Contact the merchant for help. in PayPal Payments Standard
- Should merchant pay for full refund if wrong item was shipped ? in PayPal Reporting
- Prevent changing shipping address via SET_PROVIDED_ADDRESS not working. Orders V2 Advanced Checkout in REST APIs
- cancel_url in /checkoutweb/signup page not working in PayPal Payments Standard
- After Billing Agreement conversion full billing address is not retrieved in Sandbox Environment