Open yxwu opened 3 years ago
I am getting the same behaviour. For now, I am hoping that this is only in sandbox.
Furthermore, NO_SHIPPING
is the implicit default for that prop... According to docs we don't even have to specify that prop.
This is working for us:
return actions.subscription.create({
'plan_id': <plan_id>,
application_context: {
shipping_preference: 'NO_SHIPPING'
}
});
};
or if you are using the example:
import { PayPalButton } from "react-paypal-button-v2";
export default class Example Component {
render() {
return (
<PayPalButton
options={{vault: true}}
createSubscription={(data, actions) => {
return actions.subscription.create({
plan_id: 'P-XXXXXXXXXXXXXXXXXXXXXXXX',
application_context: {
shipping_preference: 'NO_SHIPPING'
}
});
}}
onApprove={(data, actions) => {
// Capture the funds from the transaction
return actions.subscription.get().then(function(details) {
// Show a success message to your buyer
alert("Subscription completed");
// OPTIONAL: Call your server to save the subscription
return fetch("/paypal-subscription-complete", {
method: "post",
body: JSON.stringify({
orderID: data.orderID,
subscriptionID: data.subscriptionID
})
});
});
}}
/>
);
}
}
Seems shippingPreference="NO_SHIPPING" doesn't work for subscription case, screenshot attached.