How to check if PayPal subscription is still on trial period - paypal

I'm using GetRecurringPaymentsProfileDetails endpoint of the PayPal classic API to retrieve information about the subscription. From the data, I get back from that endpoint, how do I determine if the customer is still on his initial trial period and not yet on the regular billing period?

The account is on trial, if TRIALTOTALBILLINGCYCLES > NUMCYCLESCOMPLETED, that is, if you have completed less cycles that there are trial cycles.

It's been a while since I worked with that API, but I think that if they are on trial you should be able to tell by looking at PROFILESTARTDATE. If it's in the future it should be on trial still.
Another option could be NUMCYLESCOMPLETED. I don't think a trial counts as a full cycle.
https://developer.paypal.com/webapps/developer/docs/classic/api/merchant/GetRecurringPaymentsProfileDetails_API_Operation_NVP/

Related

Apply discounts on subscriptions with PayPal

I am using the PayPal API for subscription, so far on Sandbox and everything works as expected. I have read the whole documentation of PayPal api and unfortunately couldn't find what I need, that's why I'm asking here.
I am recently considering to add Discounts as well, and wish to have that in two ways:
New customer enters the discount code the first time they want to join the company. (e.g. use the Valentines Discount Code and get 10€ on your first month).
Already existing customers get a discount on one of the months. (Let's say they pay 25€ monthly, and they get a 10€ discount in the 3rd month for whatever reason, now the payments look something like this. 25€ 25€ 15€ 25€ etc...).
Is there really no way to add discounts to subscriptions in PayPal? I would be really glad for any hints / help. Thank you.
For discounts at checkout time, when creating the subscription and specifying a plan_id, you can also specify a plan object with different billing cycle values that override it, for example a lower regular amount or an additional lower amount trial period. See the Create Subscription API call; available parameters for the createSubscription JS SDK function are the same.
For discounts after a subscription is active, you will need to update the subscription. This can be done with the Update Subscription patch API call.

PayPal subscription package trial setting

In our website user can sign up with different subscription packages with some days trial version using PayPal.
Can we change trial days after creating subscription in PayPal? We have mistakenly set weeks instead of days. We want to change it back to days. Is there any way?
Using the Subscriptions API, you can make changes, but the subscriber must approve those changes for them to take effect.
Since they must give their approval anyway, if you don't know what you are doing you may find it easier to have them cancel their existing subscription and sign up for a correct one.

paypal express checkout recurring profile start date

We are using paypal recurring payments programmatically using the Express Checkout APIs.
Based on the docs, it seems that the profile can take up to 24 hours to activate. I'm trying to figure out how to setup the billing start date such that it charges on the day that the profile activates, rather than forcing it to wait up to 24 hours.
Based on the API docs, it seems that I need to pass in the start date at the time of profile creation, which has forced me to do (today + 1 day) to force the 24 hour delay. But then if the profile activates right away and I get an IPN message, i still have to force the customer to wait for that 24 hour period...which doesn't seem very nice.
Although i can do an initamt for an upfront payment, I'm trying to avoid doing it b/c i think that would make me reduce the renewal period (e.g. if it's a 6 month subscription, i would charge 1 month upfront and do a 5 month recurring.), which would be confusing for the consumer.
I'm hoping someone can help me with this.
Docs.
Just wanted to follow-up on this. I spoke with PayPal today to clarify the issue.
They recommended using an initial payment to charge right away and then reducing the subscription term by 1 interval. So if you have a six month payment, then do a 1 month charge immediately, then do a 5 month recurring. Seems sort or ridiculous and partially confusing for the consumer.
They also confirmed that the initial recurring profile step may be delayed up to a day b/c it is run as batches.
Put that together with the fact that the system skips February for end of month payments (they adjust to the first of the month), and you've got yourself a lot of fun times ahead.
Ya it's best to do an initial payment and then subtract one from your interval or put your start interval 1 unit into the future.
Also note that if the initial payment if unable to be charged the API call will fail where as without the initial payment the API call can go through (success response) but when the payment gets charged (up to 24hrs later), it has the chanced to not be successful.
ie. credit card is good so it approves the recurring billing but when it attempts to charge, for some reason it gets rejected.
Make sure you have IPN listeners for recurring_payment_skipped to take account for that.
Simply charge for 6 month instantly and set the recurring payments to start after 6 months from the moment of initial payment.

What is the short message when refunding a timed-out transaction - PayPal?

When debiting a user's PayPal account, PayPal server doesn't respond within a certain period of time (timed-out). We decided to assume that money has actually been taken, so we issue a refund. But what happens if money was not taken from user's account? What short message does PayPal return? I have had a look at the API and it doesn't tell me which one is for this situation.
Thanks in advance.
You're going about this the wrong way in my opinion.
The answer to your question would be PayPal's TransactionSearch API to search for the last transaction.
If there are no results, no transaction took place. If there are results, a transaction took place.
You could then pull the transaction ID off of this and call the DoRefund API to refund the buyers.
However, in my opinion you should find out why PayPal would time out in the first place. I'm pretty sure this wouldn't be a time out on the PayPal end, so I'd do some digging as to the actual cause of this time out, rather than trying to work around it with all sorts of hacks (doing a refund because of a time out is nothing more than a quick hack.)

PayPal TimeOut - DoExpressCheckoutPayment

We are using PayPal on a faily large website, integration went well with all code helpers from the integration wizard. Now we had processed a number of transactions in the first day of putting this live but a small percentage (5%) essentially had there transaction processed by PayPal but our system recieved a TimeOut. I believe this happens at the point where we submit the "DoExpressCheckoutPayment" Method. and because of this the system cannot tell if the payment has been complete or not.
This is a real tough one, as the website has a live currency that we need to update so paypal taking the money but the system not updating is not acceptable.
I'm interested to know if this is a common problem and how we should go about handeling it. I'm doing my best to re-create the issue but cannot at this time.
This looks like a similar problem - https://www.x.com/thread/45136
Any help would be appriciated!
Add retry logic to your application. This is a common way of handling this problem.
After looking into this in more depth, retry logic is not a good idea as the TimeOut is due to the response (So paypal has most likly credited the account).
Instant Payment Notification (IPN) seems to be the solution.