Can i create subscription and plans directly in JavaScript on the page ?

Pascalf1324
Contributor
Contributor

Hi,
Currently on my site, members can subscribe to different recurring plan.

Everything seems to work but the problem I encounter is that we have to pass the plan_id in the JavaScript Code, and therefore the plan_id only accepts a description and i can't setup different language... When i've create the product and plan in my PalPal dashboard.

On my site, I can sell the same service on my site to members from English-speaking countries, but also to members from French-speaking countries.


Here is a simalar code that i use:

 

<script>
paypal.Buttons({
 style: {
   shape: 'rect',
   color: 'gold',
   layout: 'vertical',
   label: 'subscribe'
 },
 createSubscription: function(data, actions) {
   return actions.subscription.create({
   /* Creates the subscription */
   plan_id: 'P-82B73303CA584772TMBOW7LA'
 });
 },
 onApprove: function(data, actions) {
   alert(data.subscriptionID); // You can add optional success message for the subscriber here
 }
}).render('#paypal-button-container-P-82B73303CA584772TMBOW7LA'); // Renders the PayPal button
</script>

 
Is there a way.. to by pass the original description of the plan_id made in my Dashboad to insert a description in the language of the user ?

Or it is possible with PayPal to create a subscription in JavaScript code (like the code above) but for an unexisting plan.. so i will be able to give the price, the currency and the description in the right language?

Thanks so much ! 

Have a great day ! 
Pascal

Login to Me Too
4 REPLIES 4

Pascalf1324
Contributor
Contributor

Hi to all ! 

Any idea ?
Any help will be much appreciated!
Thanks so much ! 
Pascal

Login to Me Too

Kavyar
Moderator
Moderator

Good day @Pascalf1324 

 

Thank you for posting to the PayPal community.

 

I suggest using the "locale" value to meet your requirement, which should assist you in achieving the desired result.

 

For additional information, please refer to the detailed guide link provided below:

 

https://developer.paypal.com/sdk/js/configuration/#link-locale

 

The locale renders components. By default, PayPal detects the correct locale for the buyer based on their geolocation and browser preferences. It is recommended to pass this parameter only if you need the PayPal buttons to render in the same language as the rest of your site.

 

If you are still experiencing issues, please create an MTS ticket via the following URL - https://www.paypal-support.com/s/?language=en_US . Please ensure that you provide detailed information and error details when submitting the ticket.

 

Sincerely,

Kavya

PayPal 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

Pascalf1324
Contributor
Contributor

Hi Kavyar,

Thanks for your message. 

Thank you for the suggestion but it doesn't quite answer my request.

I re-explain, in fact, the 'locale' changes the display language of the payment form and it's OK for that, it works for me, but where I find that there is a problem is, if the user clicks on the drop-down list to read the details of the plan. Look at the image I sent you with this message. The form is in English and it's OK, but my description is in French.

Is it possible to have this description in English (Or the desired language, Spanish or other)?

Should I create a topic on the link you gave me?

Also, for your information, the description of the plan is in French because I myself wrote it in French on the PayPal subscription dashboard. Except that I sell the same service to people who speak English, French and Spanish. So is there a way to display the description in a specific language WITHOUT having to create a plan for each language?

THANKS
Capture.JPG



Login to Me Too

Kavyar
Moderator
Moderator

Good day @Pascalf1324 

 

I kindly request that you create an MTS ticket by using the provided  https://www.paypal-support.com/s/?language=en_US link. Please ensure that the ticket includes detailed information and error details.

 

Sincerely,

Kavya

PayPal 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.