How to handle failed recurring payments

This example will show you how to handle declined recurring payments and a customer triggered profile update.

Using a merchant backend

Starting situation for a declined payment:
The monthly 25 € charge of customerID 985467_45486 was declined.

<etp:AcceptPayment>
   <merchantID>92883</merchantID>
   <tid>INV 2016-11 JDoe</tid>
   <pType>PROFILE</pType>
    <payment>
     <amount>2500</amount>
     <currency>EUR</currency>
     <useProfile>true</useProfile>
    </payment>
   <customerID>985467_45486</customerID>
   <customerName>John Doe</customerName>
</etp:AcceptPayment>
<etp:AcceptPaymentResponse>
   <status>ERROR</status>
   <returnCode>DECLINED</returnCode>
   <mpayTID>3303581</mpayTID>
   <errNo>1</errNo>
</etp:AcceptPaymentResponse>
  1. A mail is sent by the merchant to inform the customer about the failed payment.
    Within this mail you can place a link to the customers open invoices.
    https://www.yourdomain.com/invoiceoverview.php?INV=INV%202016-11%20JDoe
  2. The customer clicks on the provided link and is redirected to your login panel
  3. After a successful login the invoice overview is shown.
350
  1. The customer pays the invoice using the provided "Pay now!" Button.
  2. The payment should include the customers ID in order to update the stored profile.
<etp:SelectPayment>
   <merchantID>92883</merchantID>
   <mdxi>
     <Order>
      <Tid>INV 2016-11 JDoe</Tid>
      <TemplateSet Language="EN" CSSName="MODERN"/>
      <PaymentTypes Enable="true">
       <Payment Type="CC"/>
       <Payment Type="ELV"/>
       <Payment Type="PAYPAL"/>
      </PaymentTypes>               
      <Price>25.00</Price>
      <Customer Id="985467_45486" UseProfile="true">John Doe</Customer>
     </Order>
   </mdxi>
</etp:SelectPayment>
  1. After payment the profile was updated and can be used for following charges.

Starting situation for a customer triggered profile update:
The customer wants to change the stored payment credentials.

  1. The customer uses your login panel to authentication with your system
  2. After login the customer can choose "Update your payment details" from the navigation
  3. A new payment (using the existing customer Id) is initiated.
<etp:SelectPayment>
   <merchantID>92883</merchantID>
   <mdxi>
    <Order>
     <Tid>PUpdate JDoe</Tid>
     <TemplateSet Language="EN" CSSName="MODERN"/>
     <PaymentTypes Enable="true">
      <Payment Type="CC"/>
      <Payment Type="ELV"/>
      <Payment Type="PAYPAL"/>
     </PaymentTypes>               
     <Price>0.10</Price>
     <Customer Id="985467_45486" UseProfile="true">John Doe</Customer>
    </Order>
   </mdxi>
</etp:SelectPayment>

🚧

Attention

In order to generate a valid profile, we need to authorize/charge an amount. You can make a reversal/refund after profile creation.

  1. After successful payment the profile is updated.

Without a merchant backend

In case you do not have a backend with user authentification.

Starting situation for a declined payment:
The monthly 25 € charge of customerID 985467_45486 was declined.

  1. If a Confirmation-URL is set within our Merchant Interface, or provided within the request, we will call this URL for every state change. e.g. for BILLED or ERROR
    https://www.yourdomain.com/confirmation.php?OPERATION=CONFIRMATION&TID=ABO-123456-JD&STATUS=ERROR&PRICE=2500&CURRENCY=EUR&P_TYPE=CC&BRAND=VISA&MPAYTID=3325427&USER_FIELD=&ORDERDESC=&CUSTOMER=Jenny+Doe&CUSTOMER_EMAIL=&LANGUAGE=DE&CUSTOMER_ID=985467_45486&PROFILE_ID=&PROFILE_STATUS=ERROR&FILTER_STATUS=OK&APPR_CODE=
  2. This call can be used to trigger a mail to the customer.
    
  3. Within this mail you can place a link (with a reference to the unpaid charge).
    
    e.g.: https://www.yourdomain.com/charge_failed.php?tid=ABO-123456-JD
    (Be sure that the customer can only pay his bill)
  4. If the customer clicks on the link, you can gather all necessary data from your database.
    TID, open amount, customer_id,...
  5. The data can be used to create a SelectPayment request, redirecting the customer to our payment page.
  6. The customer pays the open charge (in the background the profile is updated).