I have integrated paypal php rest api to create plan and then I have create billing agreement for this plan but the issue is payment is not deducting instantly and I want to know that how will came to know that payment is deducted from payee account.
after executing billing agreement I get object of billing agreement as response and in that object it show that billing agreement is activated but in payee's account transaction status of agreement is pending in response object outstanding amount is also zero
I want to know way to identify that amount is deducted form payee's account or not. so that I can take action accordingly.
I have solved this issue but for this I have to use callback or we can say webhooks
One more thing was there is
Webhook never works on subdomain and ssl is also requiered .
Related
I am building a paypal subscription system but i have some difficulties to understand some points. When using sandbox i can't simulate a payment denial process so when the payment is made, paypal redirect me to my "approval url callback" and a billing agreement is created.
So i want to know , in a real situation, will paypal redirect me to the approval url and create this billing agreement even if the payment didn't occur yet ? or this one can be created if and only if the payment is accepted ? (So if paypal denied the payment the billing agreement will never be created)
In my case, my customers will need to access to some paid features of my website so, should i wait for the "ipn webhook notification (PAYMENT.SALE.COMPLETED)" which can take several minutes to be fired to my endpoint, or can i grant access immediately after the billing agreement is created ?
Which is the most secure thing to do ?
thanks.
If the user cancels the checkout, Paypal will redirect to your cancel URL.
But the failed payment cases are not clear to me either. I believe that the agreement will be created even if the payment fails, since it needs to exist for the payment attempt to be done, but I don't work at Paypal :).
My approach is to activate the subscription on a successful redirect no matter what, [edit: the execute response returns an agreement_details.next_billing_date in the past, so you can't use that] with a short initial subscription expiration (4h). When our webhook receives a PAYMENT.SALE.COMPLETED message, we fetch the agreement billing agreement details, and update the subscription expiration to the new agreement_details.next_billing_date. But if the webhook receives a PAYMENT.SALE.DENIED, we just let the subscription expire.
HTH.
We require reference transactions via PayPal to bill customers monthly with varying amounts.
e.g. first month is $30, second month may be $35, third month may be $25 etc
So far this seems to be the best approach: https://developer.paypal.com/docs/classic/express-checkout/integration-guide/ECReferenceTxns/
I am using the PayPal recommended SDK from this page: https://developer.paypal.com/docs/classic/api/nvpsoap-sdks/
and using the ExpressCheckout Method. (paypal/merchant-sdk-php installed via composer)
We have a free PayPal business account.
Testing via Sandbox I am able to:
Get a token (SetExpressCheckout) - category->Digital, billingAgreement, Type=Sale
forward customer to sandbox paypal login
Confirm the payment
redirect back to our system (returnUrl)
Process the payment (GetExpressTocket + doExpressCheckout)
Questions:
Does the PayPal business account require any switch/status/upgrade to enable Reference transactions on the live environment?
How do you setup a $0 billing agreement to invoice an amount later in the month? When passing a 0 amount in step 1 above and error is displayed
Item name, amount and quantity are required if item category is
provided, ErrorCode 10003
This contradicts to documentation https://developer.paypal.com/docs/classic/express-checkout/integration-guide/ECReferenceTxns/#setting-up-a-billing-agreement-before-payment which states to set the amount to 0...?
UPDATE: Removing the setting $itemDetails->ItemCategory = 'Digital'; solved the $0 amount issue.
Billing ID is not returned even though I've passed the BillingAgreement data
// Billing agreement details
$billingAgreementDetails = new BillingAgreementDetailsType('MerchantInitiatedBillingSingleAgreement');
$billingAgreementDetails->BillingAgreementDescription = $billingAgreementTxt;
$setECReqDetails->BillingAgreementDetails = array($billingAgreementDetails);
I know there are a few questions within the post but I believe they are all related to the scope of 'Reference Transactions' within PayPal.
I'm looking for recommendations on approach and explanations to the contradictions in documentation. (or if I'm doing something wrong then happy to hear it)
To answer your question:
1) Does the PayPal business account require any switch/status/upgrade to enable Reference transactions on the live environment?
If you are receive an error when calling for Reference Transaction, probably that the setting is turned off in your account. You will need to contact PayPal Business Support team to enable it.
2) Billing ID is not returned.
To setup billing agreement, you will need to pass paymentaction=authorization in SetExpressCheckout request. You will not be able to setup billing agreement if you set the paymentaction as sale.
I'am having troubles about how to handle the paypal recurrent payment system.
I followed every instruction in the website, but once i create the profile, paypal puts it in pending, making me doubt about the reliability of the service itself.
I tried to look over the internet but i didn't really get how this should work...
i made the first call with SetExpressCheckout in order to create the request, when the token is returned, i send the token to the paypal page, the user confirms the payment, then i call the CreateRecurringPaymentsProfile method to confirm the operation (passing PAYERID and TOKEN and setting the AMT value for the first payment and the PROFILESTARTDATE as now +1 month for the future payments)
Now when i try to read the response from the last call (or if i go to the buyer/seller paypal account) i see that the payment is in pending and i have to wait an undefined amount of time before this payment is activated.
Now the real question is: can i trust the fact that even if the payment is in pending, i'll receive the payment and so i can set set the user as member or i have to check and wait until the status is 'active' with the GetRecurringPaymentsProfileDetails method?
PS: i'm doing this in the sandbox version, maybe the official version is a bit faster and more reliable?
Thank you!
In Sandbox as in Live when you call CreateRecurringPaymentsProfile you will also get the response in which it will give you the status of the profile (ActiveProfile or PendingProfile). When the status is in Penidng it means that the system is in process of creating the recurring payment profile. You can then check your IPN messages for an update. It is normal but obviously if you notice that all the profiles you create get into Pending and never activate then there could be a bug but should not be the case. In here is the PayPal technical guide for this API: https://developer.paypal.com/docs/classic/api/merchant/CreateRecurringPaymentsProfile_API_Operation_NVP/
I'm not a developer, but a project manager. So please excuse my lack of proper language.
We are trying to figure out how to handle subscription refunds and then limit account access on the site.
Here's a scenario. Member signs up for an annual subscription to gain certain capabilities in the account. 3 months into it member decides to cancel and requests a refund. Normally, if no refund is issued, subscription is good until the end of the billing period, at which point account is deactivated.
In our case, if a refund is issued, account should be deactivated immediately. Question: is it possible to set this up as part of PayPal Subscriptions? Some type of call from PayPal to our system that will trigger account deactivation.
Thank you.
We recommend using IPN (Instant Payment Notifications) to be asynchronously notified of any events, in this case of those related to existing subscription/recurring payments.
https://developer.paypal.com/webapps/developer/docs/classic/ipn/gs_IPN/
If you enable IPN notifications you will receive a POST of PayPal in the following events (among others):
When a recurring profile is cancelled.
When a refund has been made to a previous completed transaction.
This way, you can set up your IPN script to keep the subscription “open” in your side for the remainder of the month even if the profile has been cancelled, or to deactivate it if the last month has been refunded.
For more information about IPN variables:
https://developer.paypal.com/docs/classic/ipn/integration-guide/IPNandPDTVariables/
Using the parallel payments paypal api. If user 1 makes a payment to user 2, I make a check using the api to make sure paypal returns the payment details as COMPLETED.
How long does paypal keep that COMPLETED payment record? Do they keep it indefinitely, or do they delete it after a while? I ask because I am at the stage of development where I need to decide if I should rely on paypal keeping that record indefinitely, or if I should create a record on my server that the payment has been completed, or if I should always check if the payment has been marked as COMPLETED by querying paypal?
The only reason why I "want" to check via paypal, is if the payment is ever returned to user1 as REFUNDED or PARITALLY_REFUNDED when paypal is queried using their apis. I would want to act accordingly in such situations.
It's not too much of an issue if the status is REFUNDED or PARTIALLY_REFUNDED as apparently people can't get refunds if they don't open a case with paypal before 45 days are up. I am more concerned about the REVERSED status, which can apparently happen any time, even after 45 days which is beyond paypal's control, as it is done by the credit card companies, if the user pays by credit card...
Using the PaymentDetails request I was able to pull my oldest Adaptive Payment transaction, which was over 60 days old and had no problems pulling it up using the transactionId field. It should be able to pull up payments as long as they are listed in the PayPal account (currently forever.)
This will work using the payKey field also if you are storing that instead of transactionId, however the transactionId is displayed in your PayPal account and is sent with IPN responses.