showing custom_id information in a subscription

jetmanjim
New Community Member

I'm trying to pass a serial number into a subscription that shows on the buyer side when the purchase a subscription.  I'm trying to pass this information in the custom_id variable.  Here's the code:

<form>
<label for="serial_number">Serial Number(s):</label>
<input type="text" id="serial_number">
</form>

<div id="paypal-button-container-P-5D310620RF0223030MPKW6GI"></div>
<script src="https://www.paypal.com/sdk/js?client-id=MYMEMBERID&vault=true&intent=subscription" data-sdk-integration-source="button-factory"></script>
<script>
paypal.Buttons({
style: {
shape: 'pill',
color: 'gold',
layout: 'vertical',
label: 'subscribe'
},
createSubscription: function(data, actions) {
return actions.subscription.create({
/* Creates the subscription */
plan_id:PresetSubscriptionID,
custom_id: serial_number
});
},
onApprove: function(data, actions) {
alert(data.subscriptionID); // You can add optional success message for the subscriber here
}
}).render('#paypal-button-container-PRESET Subscription ID'); // Renders the PayPal button
</script></A></p>

 

It doesn't work.  MyMemberID, and SubscriptionID contain the actual values from paypal. Can someone please tell me why and how to fix

Login to Me Too
1 REPLY 1

MTS_Chiranjeevi
Moderator
Moderator

Good day @jetmanjim,

 

Thank you for posting to the PayPal community.

 

Please refer the below guide link and try passing the "custom_id" value for the subscription. 

 

custom_id
string [ 1 .. 127 ] characters

The custom id for the subscription. Can be invoice id.

 

https://developer.paypal.com/docs/api/subscriptions/v1/#subscriptions_create!path=custom_id&t=reques... 

 

If your still facing any issues, please create a MTS ticket via -  https://www.paypal-support.com/s/?language=en_US with the detail information and error details.

 

Sincerely,

Chiranjeevi

PayPal/Braintree MTS

 

If this post or any other was helpful, please enrich the community by giving kudos or accepting it as a solution.

Login to Me Too

Haven't Found your Answer?

It happens. Hit the "Login to Ask the community" button to create a question for the PayPal community.