paypal - 'subscription profiles not supported'
Asked Answered
T

3

6

I'm using website payments standard to create recurring payments for subscriptions.

I need to find out when the next billing date is, so it looks like I can use GetRecurringPaymentsProfileDetails nvp api with the recurring payment profile id.

But when I send the recurring payment profile id I get a failure back:

{'ack':'Failure',.... l_longmessage0: 'Subscription profiles not supported by Recurring Payment APIs.',
'l_shortmessage0': 'Subscription Profiles not supported.',....

Does this mean that subscription button recurring payment profiles cannot be retrieved via the GetRecurringPaymentsProfilesDetails NVP api?

If that is the case, is there some other api to get this detail for a subscription profile?

Torquemada answered 17/12, 2009 at 4:25 Comment(0)
T
7

GetRecurringPaymentsProfileDetails does not support subscription profiles created through payments standard, it only supports recurring payment profiles created through the nvp api.

As of this writing, there is no api to get the subscription details. If you want to know the current status, you have to use an IPN listener to capture and track all status changes yourself.

Torquemada answered 29/12, 2009 at 11:43 Comment(9)
Do you know if that's still the case, now that 2 years have passed since your answer?Chain
SERIOUSLY, even I want to use API to cancel subscription .. any way ?Wet
@Is there any solution after 6 years without ipnBiologist
@dar, Can you explain your last sentence? If I have the subscr_signup ipn message, is there something in it that would enable me to check the subscription status in the future?Aculeate
@Aculeate as far as I know, no. IPNs are pushed to your endpoint, you cannot look up status. You have to listen for the events listed here: paypal.com/us/cgi-bin/webscr?cmd=p/acc/… and act accordingly. You can look up the status in the on the website, but that is time consuming and manual. I have not kept up on the api recently.Torquemada
@Torquemada - I agree. I submitted a clarification edit to your last sentence.Aculeate
I just confirmed this is still unsupported, PayPal expects us to keep track of the subscription's status through the IPN notifications. For instance, you'd need to save a subscription entity in your database and update it every time an IPN is received that changes the status for it.Refutation
Here we are at year 7. :(Alleviator
@JudeCalimbas how do you cancel using the API?Alleviator
H
2

You can hijack API by using /v1/payments/billing-agreements/{billingid}/transactions?start_date=YYY-MM-DD$end_date=YYY-MM-DD... then you juste have to check if last transactions fit your period.

Hydrophobia answered 8/11, 2016 at 17:20 Comment(2)
He's onto something.. you CAN get some information if you request the transaction list, but you CAN'T get anything if you request the plan details.Unpaged
@Unpaged yes, exactlyHydrophobia
B
0

I am getting it through this way:

let options = {
 method: 'post', headers: {'content-type':'application/json','Access-Control-Allow-Credentials':true},
 auth:{'username':process.env.PAYPALID,'password':process.env.PAYPALPASSWORD},
 url: 'https://api.paypal.com/v1/oauth2/token',
 data: 'grant_type=client_credentials',
}
axios(options).then((response)=>{let paypaltoken=response.data.access_token
axios.get('https://api.paypal.com/v1/payments/billing-agreements/'+agreementid+'/transactions?start_date=2018-01-01&end_date=2019-07-07', { headers: { 'Authorization':'Bearer '+paypaltoken, 'Content-Type':'application/json', } })
.then((transaction)=>{console.log(transaction.data)})
.catch(err => {console.error(err);console.log('err: '+JSON.stringify(err)); res.send (err) })
})
.catch(err => {console.error(err);console.log('err: '+JSON.stringify(err)); res.send (err) })

then if you get just the transaction.data, you will get a series of transaction objects, whose status is == Completed only if the transaction went ok, that is, it has not been cancelled, so just check the last for plan controlling purposes. When status is == Canceled you know the agreement is not active anymore.

Another way to do it if you receive monthly payments is to set the first date to 2 months from "now()" and the second date to "now()". If you get no transactions then the status could be not active, but double-check: there is the random possibility there could have been some credit card problem. In that case I suppose status could be == to delayed or something else, but I had no possibilities to test it so I don't know. The idea came from this question and the relative second answer which deserves my gratitude as well as Cyril ALFARO.

Note that according to your case you may need to add 'Access-Control-Allow-Credentials':true in the headers instead of other withCredentials: true or similar in the request.

Bosley answered 7/7, 2019 at 18:53 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.