Getting error when trying to Cancel the recurring subscription using API - paypal

I have PayPal Website Payments Standard configured in my site. User can subscribe the membership with Paypal Recurring. I have adde API to cancel the subscription using "ManageRecurringPaymentsProfileStatus". But it returns the error "The profile ID is invalid".
But the Profile ID in the API call is same as the Profile id in the Paypal . ID is like S-79440077XXXXXXXXX.
API Call
USER=%USERNAME% &PWD=%PASSWORD% &SIGNATURE=%SIGNATURE% &VERSION=76.0
&METHOD=ManageRecurringPaymentsProfileStatus
&PROFILEID=S-79440077XXXXXXXXX &ACTION=Cancel
&NOTE=Profile+cancelled+at+store
Response
TIMESTAMP=2018-03-01 T06:59:10Z &CORRELATIONID=b445f660c29d8
&ACK=Failure &VERSION=76.0 &BUILD=39949200 &L_ERRORCODE0=11552
&L_SHORTMESSAGE0=Invalid profile ID &L_LONGMESSAGE0=The profile ID is
invalid &L_SEVERITYCODE0=Error
Please help to resolve the issue.
Thank you!

The API operation ManageRecurringPaymentsProfileStatusRequest doesn't support PayPal Subscriptions (S-XXXX). The API operation works for only recurring profiles(I-XXXX) which were created via express checkout recurring payments.
You are passing the subscription id(S-XXX) as I-XXXX profile in the API request by replacing the S with I as I-7XXXXXXXXXXXX4R, this is an invalid I-XXXX profile, hence you are receiving the error as an Invliad profile.
If you pass the correct S-XXX profile value in the API request then you will get the error-- Subscription profiles are not supported for recurring payments.

Related

How to get IPN notification for subscription at client site if user suspend it from paypal account interface

I want to update the status of subscription in database based on changes in PayPal user's account. I am not getting any notification from paypal side for it. What should I do for it. Our site is working as a platform and our client provide subscription for their customers. So when a customer changes the status of subscription in PayPal side then the same status needs to update at our side. We have used IPN not API. Please suggest.
It depends on the type of the subscription integration you have.
If it is a classic subscription that was created with a notify_url specified for IPN, then you should receive an IPN message with the txn_type subscr_cancel, as documented here: https://developer.paypal.com/docs/api-basics/notifications/ipn/IPNandPDTVariables/
If you have a current PayPal Subscriptions integration, you can subscribe to the webhooks event BILLING.SUBSCRIPTION.CANCELLED, as documented here: https://developer.paypal.com/docs/api-basics/notifications/webhooks/event-names/#subscriptions

Validate PayPal Client id

I have been trying to validate Paypal client id but I didn't landed to any solution from Paypal documentation and also from other sources.
Anyone please help me if there is any API to validate Paypal's Client id.
You may want to look at PayPal Adaptive Accounts API. You can use GetVerifiedStatus API Operation to determine whether the specified PayPal account's status is verified or unverified.

How to test a PayPal capture API call with Sandbox

I have setup PayPal Sandbox test accounts, a Personal (buyer) and a Business (merchant).
I'd like to test a PayPal 'DoCapture' API Operation. The problem I'm encountering is that I need an AuthorizationID and don't know how to obtain it. If i run the 'DoExpressCheckoutPayment' API call, I do not get an AuthorizationID returned, using the merchant API credentials, though I do get an 'ACK' of success. Do I need to be using the buyer credentials with the 'DoExpressCheckOutPayment' call? I don't see the API credentials in the PayPal Sandbox profile for the Personal account.
Express Checkout example with authorization and capturing you can find here.
Short answer - according with DoCapture documentation
AuthorizationID ... This is the transaction ID returned from DoExpressCheckoutPayment...
According with DoExpressCheckout documentation you need field from response, attention, PaymentInfo#TransactionId
... this value is your AuthorizationID for use with the Authorization & Capture APIs.
This is what you need to do to implement the capture API.
Create Payment: set intent as authorize in its request to get payment Id
Show Payment Details: to get approval_url. The customer will use this URL to pay for the order.
Execute approved PayPal payment: Use this API after customer successfully pays for the order. This API returns authorization-id along with capture link.
Use Capture API: use the URL obtained from step 3 to capture.
Use this link and check payments API.
https://developer.paypal.com/docs/api/payments/#payment_execute
Hope this helps to someone who stumbles upon here.

Paypal Subscription Details

Can you help me. I need to know if PayPal has an API call to get subscription details like the enddate of the subscription?
I do the request to PayPal and get the response,
SUCCESS
transaction_subject=Name20
payment_date=10%3A42%3A50+Mar+28%2C+2014+PDT
txn_type=subscr_payment
subscr_id=I-MWMMATTBSY2M
last_name=jls
....
but I need details from suscription as enddate.
Sounds like you're using Standard Subscriptions and the "response" you're referring to would be an Instant Payment Notification (IPN)..??
Unfortunately, the standard subscriptions system doesn't have any API's to access details directly. You could switch to Express Checkout and the Recurring Payments API, though, and this would give you access to API's to obtain details and manage the profiles programatically.
If you're working with PHP you can setup Express Checkout and Recurring Payments very easily using my class library for PayPal.
The flow you'll be setting up would be as follows...
1) Call SetExpressCheckout to obtain a token and redirect the user to PayPal. The SEC request will also include a ReturnURL which is where PayPal sends the user after they've signed in and agreed to continue. You also need to make sure to include the Billing Agreement parameters in your SEC request so that the token you get will be compatible with recurring payments.
2) The user ends up back at your ReturnURL, and this is where you'll call GetExpressCheckoutDetails to obtain details about the buyer that the system now knows since they've signed in. This gives you info like the payer's name, email, address, etc. It also gives you the Payer ID you'll need for the final request.
3) Right after obtaining the details via GECD you'll call CreateRecurringPaymentsProfile to finalize the subscription profile creation.

ipn using customer business pp account

my ipn works perfectly its setup under our business PayPal account. our asp.net website is being used by multiple customers with their own members, unique by their login. as of now the cart writes to our database with the orders and sets a status code that gets changed to 'completed' via the ipn call/authentication from PayPal using our PayPal email. now, a couple want to use their own PayPal accounts, non-for profits, so in order for this to work as previously described what changes in the post variables?
ex of what i need: a member of our customer logs in to our website, adds items to their cart and chooses PayPal payment option. it writes to our database as an 'in-process' order. it opens our customer PayPal account to complete the payments then once complete it calls our ipn setup under our PayPal account and redirects back to the custom page.
again, everything is already working great just want to call their own PayPal account instead of ours w/o needing to have them setup the ipn settings under their account, but use the ipn setup under our PayPal account. members see their own customer PayPal account billing theme and the money is in their account not ours. is this possible?
do we send the ipn location url and our customer PayPal account info in the post variables?
thanks for any help
As far as processing the payment on their PayPal account, you can go about this 2 different ways. You can either use their API credentials and pass those over in the API call and the payment will be processed on their account. Second option would be to have them grant 3rd party API permissions to your API to be able to process transactions on their account. Then you would just pass over your API credentials in your API call and also pass over their email address of their PayPal account in the variable "SUBJECT". This will then process the payment on their account.
As for still haveing the IPN POST sent to your script, you will just need to pass over the IPN URL in the API call. When pass it over in the API call, it will override whatever is set in the account. For example, if you are using NVP the variable would be "NOTIFYURL".