Paypal recurring payment enough money - paypal

I'm testing recurring payment on Sandbox of Paypal.
But I find out client's account is not enough money, but their own account is still recieved money.
If client 's account is not enough money, how does the paypal process?
This transaction will be suspend or cancel...
If client'account have enough money then the transaction become activate.

For initial payment, use FAILEDINITAMTACTION, Action you can specify when a payment fails. It is one of the following values:
ContinueOnFailure – By default, PayPal suspends the pending profile in the event that the initial payment amount fails. You can override this default behavior by setting this field to ContinueOnFailure. Then, if the initial payment amount fails, PayPal adds the failed payment amount to the outstanding balance for this recurring payment profile.
When you specify ContinueOnFailure, a success code is returned to you in the CreateRecurringPaymentsProfile response and the recurring payments profile is activated for scheduled billing immediately. You should check your IPN messages or PayPal account for updates of the payment status.
CancelOnFailure – If this field is not set or you set it to CancelOnFailure, PayPal creates the recurring payment profile, but places it into a pending status until the initial payment completes. If the initial payment clears, PayPal notifies you by IPN that the pending profile has been activated. If the payment fails, PayPal notifies you by IPN that the pending profile has been canceled.
Once you are into the regular billing cycle, Be sure to assign a value to MAXFAILEDPAYMENTS, which is the number of scheduled payments that can fail before the profile is automatically suspended. An IPN message is sent to the merchant when the specified number of failed payments is reached.
Then, AUTOBILLOUTAMT Indicates whether you would like PayPal to automatically bill the outstanding balance amount in the next billing cycle. The outstanding balance is the total amount of any previously failed scheduled payments that have yet to be successfully paid. It is one of the following values:
NoAutoBill – PayPal does not automatically bill the outstanding balance.
AddToNextBilling – PayPal automatically bills the outstanding balance.
it is up to you how to handle profiles that suspend.

Related

PayPal subscription payment fails after payment with insufficient funds

I am implementing subscriptions with PayPal and in my code, for the case when the payment fails, I cancel the subscription.
I tried to test the following case:
purchase a subscription with a card with insufficient funds
wait for the payment to fail
retry to pay with the same account with the same card, but with funds
a new subscription plan should be created because the initial one was cancelled
Unfortunately, the payment is not working for the account, even if the card has enough balance.
Why is this happening, why does the payment not work at the second try and how can I manage this case in my code?

Paypal Recurring Payments with initial payment creates & instantly cancels if user doesn't have balance

My PayPal recurring payment profiles have an initial payment.
My backend checks for canceled payment profiles. If the profile is canceled the subscription on my website ends at the canceled profile's expiration date (this is so people who pay for a subscription and cancel afterwards keep their website subscription until the subscription end date).
When the user doesn't have any balance or payment method bound to their PayPal, they can still create the payment profile. PayPal allows users to click 'Agree & Pay Now' and notifies my backend even though the initial payment isn't made (because the user has no paypal balance or valid payment method).
In my payment history I can see the profile has been created and canceled instantly without a payment made.
Is there a way to simply not accept payments if the initial payment hasn't gone through?
To capture the initial payment the best way is to call the doexpresscheckout API for the initial amount and then create recurring profile using the same token . In this way , if the doexpress checkout call is successful this means you receive your initial payment and their funding source also is good . Once this step is successful you can procees to create recurring profile .

PayPal Live Transaction Completed but IPN does not update from Pending

We're using PayPal Payments Standard and IPN to process payment transactions and enable digital goods download after our IPN listener script recieves notification of a completed transaction.
We've done thorough testing on the PayPal sandbox and made sure our scripts handle different scenarios properly.
Just to be sure, before opening the sales to public, we've done some testing with the PayPal live interface - performed a few small sales using a previously verified PayPal account to pay for the goods.
Our IPN listener script has immediately received notifications, but the payment_status in both of them was 'pending' with pending_reason = 'paymentreview'. After logging to our seller PayPal account a few minutes after making the payment, both transactions have the status 'Completed' and are ready to ship, yet our IPN listener did not receive any further notification updating the status of the transactions.
By checking the IPN history on our seller PayPal account, we can see that only the initial messages for both payments have been sent (with status 'Pending').
The PayPal developer docs are explicit about not allowing the download or shipping goods before the transaction is succesfully completed, yet we do not receive an update via IPN even 48+ hours after the payments.
We did not experience any such problem during testing period on PayPal sandbox interface.
Is this an issue with the IPN interface, or there is something that can be configured through our PayPal account that will resolve this issue and make IPN behaviour consistant with PayPal developer docs?

Paypal IPN - Differentiating between Recurring Payment and Initial Payment

I've created a recurring payments profile on Paypal setting an initial payment.
When I receive the IPN, the txn_id is the same for both the initial payment and the recurring payment. I would like to know if there's a way of differentiating between them.
I've noticed that when I receive the recurring payment, there's this variable "period_type= Regular". This doesn't appear in the initial payment IPN. Is this a good way to make the distinction?
Thanks
I think you might be getting confused with what you're getting in the IPN's.
When the profile is first created, you'll get an IPN with the profile ID of the profile that was just created, and you would only get a transaction ID if you included the original amount to be charged. The transaction ID here is only for that original amount. If you didn't have that all you would get is the profile ID.
If your recurring payments are scheduled to start on the same day as well you will get an additional IPN for the recurring payment and that will have its own transaction ID.

PayPal Subscription Payment Failed

When a subscription payment fails, PayPal will retry for n times.
What transaction type (subscr_cancel or subscr_eot) is sent back via IPN, after all retries fail?
The specifics depend on the PayPal product you're using, although the logic works similar(`ish) across both Website Payments Standard subscription buttons and Express Checkout Recurring Payments (via the CreateRecurringPaymentsProfile API):
This depends on whether you've set MAXFAILEDPAYMENTS or not. If MAXFAILEDPAYMENTS > 0 is set, it will cancel the subscription after n number of attempts and you'll receive a subscr_cancel. If you have it set to MAXFAILEDPAYMENTS=0, you'll get recurring_payment_skipped and the recurring payment will be marked as having an outstanding balance. If you specify AUTOBILLOUTAMT=AutoBillAmt, the outstanding balance will be added to the next billing cycle.
I would suggest taking a look at https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/e_howto_html_IPNandPDTVariables#id091EB0901HT which lists all IPN variables, including the ones for recurring payments.
Paypal returns subscr_failed for this case, and the possible return values are:
subscr_signup: subscription sign-up.
subscr_cancel: subscription cancellation.
subscr_failed: subscription payment failure.
subscr_payment: subscription payment.
subscr_eot: subscription’s end-of-term.
subscr_modify: subscription modification.
Please click here for further clarification.