Paypal-checkout-components: @Subscription: Charge user pro rata amount and subscribe user at the same time or vise versa

Created on 20 Apr 2021  路  2Comments  路  Source: paypal/paypal-checkout-components

Description

I want users to be able to choose when they want their subscription start,
of course i restrict date range from now to two weeks.

e.g. a user buys or subscribes to my service and choose that hi/her subscription start next week
so i will have to charge this user a pro rata amount like some amount this week because they will be using the service until their subscription start.

so i want to know if is it possible to make a once off payment and subscription at the same time?

i saw this issues https://github.com/paypal/paypal-checkout-components/issues/1282 and am very clear on how to intergrade subscription using the smart button. the only thing now is how do i make a purchase and subscribe a user at the same time.

Please help
Thanks in advance

subscriptions 鈦夛笍 question

Most helpful comment

You can use the start_time attribute to define when a subscription should start.

paypal.Buttons({
      style: {
          shape: 'rect',
          color: 'gold',
          layout: 'vertical',
          label: 'subscribe'
      },
      createSubscription: function(data, actions) {
        return actions.subscription.create({
          plan_id: 'P-XXXXXXXXXXXXX',
          start_time: '2021-05-30T06:02:03.518Z' 
        });
      },
      onApprove: function(data, actions) {
        alert(data.subscriptionID); // You can add optional success message for the subscriber here
      }
  }).render('#paypal-button-container-P-XXXXXXXXXXXXX');

Screenshot 2021-05-13 at 11 33 04 AM

Regarding

so i want to know if is it possible to make a once off payment and subscription at the same time?

Subscriptions supports charging a setup fee, which can be set while creating a plan. This amount will be charged to the buyers while subscribing.
Please let me know if it answers your question?

All 2 comments

You can use the start_time attribute to define when a subscription should start.

paypal.Buttons({
      style: {
          shape: 'rect',
          color: 'gold',
          layout: 'vertical',
          label: 'subscribe'
      },
      createSubscription: function(data, actions) {
        return actions.subscription.create({
          plan_id: 'P-XXXXXXXXXXXXX',
          start_time: '2021-05-30T06:02:03.518Z' 
        });
      },
      onApprove: function(data, actions) {
        alert(data.subscriptionID); // You can add optional success message for the subscriber here
      }
  }).render('#paypal-button-container-P-XXXXXXXXXXXXX');

Screenshot 2021-05-13 at 11 33 04 AM

Regarding

so i want to know if is it possible to make a once off payment and subscription at the same time?

Subscriptions supports charging a setup fee, which can be set while creating a plan. This amount will be charged to the buyers while subscribing.
Please let me know if it answers your question?

Thank you = yes this helped. i will use the setup fees

Was this page helpful?
0 / 5 - 0 ratings