Is it possible to make a refund via PayPal PayFlow API on last transaction when I'm using PayFlow recurring payments.
Thanks,
Maciek
Simple answer to this is "yes".
You need to credit as you would a normal transaction. Parameters are:
USER
VENDOR
PARTNER
PWD
TENDER=C // C = credit card, P = PayPal
TRXTYPE=C // S = Sale transaction, A = Authorisation, C = Credit, D = Delayed Capture,
ORIGID=XXXX // ORIGID to the PNREF value returned from the original transaction
Then you may need to cancel the recurring transaction to stop it happening again. Parameters are:
USER
VENDOR
PARTNER
PWD
ACTION=C // C = Cancel
TRXTYPE=R // R = Recurring
ORIGPROFILEID=XXXX // Original Profile ID (of the recurring transaction)
https://www.paypalobjects.com/webstatic/en_US/developer/docs/pdf/pp_payflowpro_recurringbilling_guide.pdf
Related
I am integrating PayPal with my site and testing in sandbox.
When the buyer opens a dispute in PayPal Resolution Center to requests a refund, then we receive an IPN with payment_status = Reversed (the refund amount requested by the buyer is removed from the seller's account balance).
Then if the seller agrees to send the full refund, closing the case, then we receive an IPN with payment_status = Canceled_Reversal (the refund amount requested by the buyer is returned to the seller's account balance) and another IPN with payment_status = Refunded (the refund amount requested by the buyer is removed from the seller's account balance and finally returned to the buyer's account balance).
This is the IPNs' payment_status sequence for such case: Reversed > Canceled_Reversal > Refunded
However, the issue occurs when the seller offers a different refund amount to the buyer, who agrees with it, getting the offered amount back and closing the case.
This is the IPNs' payment_status sequence for such case: Reversed > Refunded
It seems to me that the IPN with payment_status = Canceled_Reversal is missing. I need it for financial purposes.
What is wrong? Am I misunderstanding anything?
I set up correctly my website to support an account annual subscription payment using paypal recurring billing with payum bundle.
these are the parameters my website send to paypal on the prepare
$agreementDetails['PAYMENTREQUEST_0_AMT'] = $this->view['user']->money;
$agreementDetails['PAYMENTREQUEST_0_CURRENCYCODE'] = 'EUR';
$agreementDetails['PAYMENTREQUEST_0_ITEMAMT'] = $this->view['user']->money;
$agreementDetails['PAYMENTREQUEST_0_PAYMENTACTION'] = "sale";
$agreementDetails['L_PAYMENTREQUEST_0_NAME0'] = "Annual subscription";
$agreementDetails['L_PAYMENTREQUEST_0_QTY0'] = 1;
$agreementDetails['L_PAYMENTREQUEST_0_AMT0'] = $this->view['user']->money;
$agreementDetails['NOSHIPPING'] = Api::NOSHIPPING_NOT_DISPLAY_ADDRESS;
$agreementDetails['L_BILLINGTYPE0'] = Api::BILLINGTYPE_RECURRING_PAYMENTS;
$agreementDetails['L_BILLINGAGREEMENTDESCRIPTION0'] = 'Annual account subscription';
and these on the recurring request
$recurringPaymentDetails['TOKEN'] = $agreementDetails['TOKEN'];
$recurringPaymentDetails['DESC'] = 'annual account subscription';
$recurringPaymentDetails['EMAIL'] = $agreementDetails['EMAIL'];
$recurringPaymentDetails['AMT'] = $this->view['user']->money;
$recurringPaymentDetails['CURRENCYCODE'] = 'EUR';
$recurringPaymentDetails['BILLINGFREQUENCY'] = 365;
$recurringPaymentDetails['PROFILESTARTDATE'] = date(DATE_ATOM);
$recurringPaymentDetails['BILLINGPERIOD'] = Api::BILLINGPERIOD_DAY;
everything works fine.
my question here is that I just want to know if my clients' recurring payments will be accepted and paid. and also, if my client didn't pay his annual fee.
I mean, how to know (server side, php) the last succesful payment date for a specific account?
You'll want to configure an IPN solution. PayPal will POST data to a listener script you setup anytime a transaction takes place. You can update your database, send custom email notifications, hit 3rd party web services, or anything else you might want to automate based on payments, refunds, new profiles, suspended profiles, disputes, etc.
You can also use the TransactionSearch API and pass in a ProfileID to get the transactions associated with that profile.
I am trying to create a recurring profile using express-checkout (Payum/paypal-express-checkout-nvp).
Howto from Payum
private function createAgreement(Purchase $purchase)
{
$storage = $this->payum->getStorage('Coachup\PaymentBundle\Entity\PaymentAgreement');
$agreementDetails = $storage->createModel();
$agreementDetails['L_BILLINGTYPE0'] = Api::BILLINGTYPE_RECURRING_PAYMENTS;
$agreementDetails['L_BILLINGAGREEMENTDESCRIPTION0'] = 'test';
$agreementDetails['PAYMENTREQUEST_0_AMT'] = 0;
$agreementDetails->setPurchase($purchase);
$storage->updateModel($agreementDetails);
$captureToken = $this->securityTokenFactory->createCaptureToken(
$this->paymentName,
$agreementDetails,
'payment_checkout_progress_payment',
['purchaseId' => $purchase->getId(), 'paymentType' => $this->getId()]
);
$agreementDetails['RETURNURL'] = $captureToken->getTargetUrl();
$agreementDetails['CANCELURL'] = $captureToken->getTargetUrl();
$storage->updateModel($agreementDetails);
return $captureToken->getTargetUrl();
}
A token seems to be generated with paypal, the user gets redirected to paypal (sandbox) and once i log in to confirm the agreement, i get a generic error message (loosely translated)
"The request can not be processed, please return to the store and choose another option".
Not even an error code...
Any help?
Its possible that the initial payment of 0.00 is failing, which is making it so the billing agreement is not created. Here is a way that you can override this and create the profile anyway. This comes directly from the PayPal documentation:
By default, PayPal does not activate the profile if the initial payment amount fails. To override this default behavior, set the FAILEDINITAMTACTION field to ContinueOnFailure. If the initial payment amount fails, ContinueOnFailure instructs PayPal to add the failed payment amount to the outstanding balance due on this recurring payment profile.
If you do not set FAILEDINITAMTACTION or set it to CancelOnFailure, PayPal creates the recurring payment profile. However, PayPal places the profile into a pending status until the initial payment completes. If the initial payment clears, PayPal notifies you by Instant Payment Notification (IPN) that it has activated the pending profile. If the payment fails, PayPal notifies you by IPN that it has canceled the pending profile.
If you created the profile using Express Checkout, the buyer receives an email stating that PayPal cleared the initial payment or canceled the pending profile.
Here is the direct link in case you need it:
Recurring Billing Integration Guide
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.
Is it possible to Create a Recurring Payment Profile using DoReferenceTransaction or is there any other way to set up recurring payment when I've got "billing agree" from customer and REFERENCEID - an id of customer's previous transaction.
Thanks
You can set
RECURRING
field of DoReferenceTransaction API call, but first you need a billing agreement with buyer.
I recommend doing recurring payment with CreateRecurringPaymentsProfile call.
API is here.
I've got billing agreement with buyer ("billing agreement ID") - according to reference transaction api .
I also can do transactions with DoReferenceTransaction like:
$nvpstr="&L_AMT0=".$itemamt."&L_QTY0=1&AMT=".(string)$amt."&ITEMAMT=".(string)$itemamt."&CALLBACKTIMEOUT=4&REFERENCEID=B-6J7244599E964634T&ReturnUrl=".$returnURL."&CANCELURL=".$cancelURL ."&CURRENCYCODE=".$currencyCodeType."&PAYMENTACTION=".$paymentType;
$resArray=hash_call("DoReferenceTransaction",$nvpstr);
However I still don't know how to set up recurring payment using reference transaction cause in API link you gave me, there is a note that Credit Card ACCT number is required - but I don't want to store client's card numbers in my database (I am using express checkout).