AstropayCard Redirect Refund

The following method IDs are covered in this section:

ID

Name

Credit/Debit State

277

AstropayCardRedirectRefund

Refunded (125)

Payment method interaction type: Sychronous Execution with External Provider (see Interaction Types).

Redirect Integration

Currently not supported.

Backend2BackendIntegration

For refund of AstropaycardRedirectDeposit transactions, a bank account has to be sent, therefore such a payment is initiated with the request initiatePayment instead of the request iniitatePaymentFromReference.

Within specificPaymentAccountData we pass data associated to the bank: BankCountryCode2, AccountNumber, BranchCode, AccountOwner, BankName and AccountType.

The following table contains the fields to be sent in initiatePaymentRequest.specificPaymentData xml section:

key (value type, account type, required)

value

PaymentDescription
(string)

Description of the payment

OriginalPaymentID
(string, required)

PaymentID of the payment that should be refunded

The following table contains the fields to be sent in initiatePaymentRequest.specificPaymentData xml section:

key (value type, account type, required)

value

CurrencyCode (string)

currency code of the bank account, e.g. BRL

BankCountryCode2 (string)

Country of the bank account

AccountNumber (string)

Bank account number

BranchCode (string)

Branch code of the bank account

AccountOwner (string)

Account holder of the bank account

BankName (string)

Bank name of the bank account

AccountType (string)

Account type of the bank account: C for Current accounts, S for Savings accounts and I for International accounts

Example initiatePaymentRequest:

<?xml version="1.0" encoding="utf-8"?>
<initiatePaymentRequest xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.cqrpayments.com/PaymentProcessing">
       <merchantID>B2BTestMerchant</merchantID>
       <shopID>AstropayCardDepositShop</shopID>
       <merchantTransactionID>37b60484-27c3-4876-a692-e62dde533b51</merchantTransactionID>
       <paymentMethodID>277</paymentMethodID>
       <amount currencyCode="BRL">10.00</amount>
       <userID>a2c1ade8-eef1-4233-931d-15b31f</userID>
       <userData>
             <username>a2c1ade8-eef1-4233-931d-15b31f</username>   
       </userData>
       <userIP>127.0.0.1</userIP>
       <userSessionID>e2fe0daa-3171-4033-82fd-025ec5180479</userSessionID>
       <creationTypeID>1</creationTypeID>
       <specificPaymentData>
             <data xsi:type="keyStringValuePair">
                    <key>PaymentDescription</key>
                    <value>Refund of payment 1234</value>
             </data>
             <data xsi:type="keyStringValuePair">
                    <key>OriginalPaymentID</key>
                    <value>37b60484-27c3-4876-a692-e62dde533b51</value>
             </data>
       </specificPaymentData>
       <paymentAccount>
             <specificPaymentAccountData>
                    <data xsi:type="keyStringValuePair">
                           <key>CurrencyCode</key>
                           <value>BRL</value>
                    </data>
                    <data xsi:type="keyStringValuePair">
                           <key>BankCountryCode2</key>
                           <value>BR</value>
                    </data>
                    <data xsi:type="keyStringValuePair">
                           <key>AccountNumber</key>
                           <value>88365484</value>
                    </data>
                    <data xsi:type="keyStringValuePair">
                           <key>BranchCode</key>
                           <value>8197</value>
                    </data>
                    <data xsi:type="keyStringValuePair">
                           <key>AccountOwner</key>
                           <value>John Doe</value>
                    </data>
                    <data xsi:type="keyStringValuePair">
                           <key>BankName</key>
                           <value>Banco do Brasil</value>
                    </data>
                    <data xsi:type="keyStringValuePair">
                           <key>AccountType</key>
                           <value>S</value>
                    </data>
             </specificPaymentAccountData>
       </paymentAccount>
</initiatePaymentRequest>

Example intiatePaymentResponse:

<?xml version="1.0" encoding="utf-8"?>
<initiatePaymentResponse xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.cqrpayments.com/PaymentProcessing">
  <payment xsi:type="paymentWithPaymentAccount">
    <merchantID>B2BTestMerchant</merchantID>
    <shopID>AstropayCardDepositShop</shopID>
    <paymentMethod>
      <key>277</key>
      <value>AstropayCardRedirectRefund</value>
    </paymentMethod>
    <merchantTransactionID>e67f389d-f3e5-4cce-a755-9b8aada4b46b</merchantTransactionID>
    <paymentID>9c0da71f-22d3-40f7-aff2-038a4fe890c5</paymentID>
    <userID>220e3828-fe7d-432d-a09c-7856ab</userID>
    <paymentProvider>
      <key>152</key>
      <value>Astropay</value>
    </paymentProvider>
    <amount currencyCode="BRL">10.00</amount>
    <creationType>
      <key>2</key>
      <value>MerchantOperator</value>
    </creationType>
    <state>
      <id>1c257c3b-2608-4ce8-9a30-978cbeea5656</id>
      <definition>
        <key>125</key>
        <value>Refunded</value>
      </definition>
      <createdOn>2017-09-19T07:30:59.9305846Z</createdOn>
      <description>Amount refunded (final status)</description>
      <paymentStateDetails xsi:nil="true" />
    </state>
    <isExecuted>true</isExecuted>
    <baseAmount currencyCode="EUR">2.65</baseAmount>
    <paymentDetails>
      <detail xsi:type="keyIntValuePair">
        <key>OriginalPaymentID</key>
        <value>1589841</value>
      </detail>
      <detail xsi:type="keyStringValuePair">
        <key>ProviderExternalID</key>
        <value>9c0da71f-22d3-40f7-aff2-038a4fe890c5</value>
      </detail>
      <detail xsi:type="keyStringValuePair">
        <key>ProviderTransactionID</key>
        <value>b3784f28-c8c6-4ddf-b4b6-603760f93594</value>
      </detail>
    </paymentDetails>
    <paymentAccount>
      <paymentAccountID>2cdf30a3-5802-4003-b175-67e441daa49f</paymentAccountID>
    </paymentAccount>
  </payment>
</initiatePaymentResponse>

Notifications

handlePaymentStateChangedNotificationRequest

The provider notifies PXP Financial on payments that are either Successful (state DepositedByProvider), Declined (state RefusedByProvider).

Payment States

Description

Refunded

Success state.

RefundRefusedByProvider

Payment has been rejected by the provider.

Example handlePaymentStateChangedNotificationRequest:

<?xml version="1.0" encoding="utf-16"?>
<handlePaymentStateChangedNotificationRequest xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <payment xmlns="http://www.cqrpayments.com/PaymentProcessing" xsi:type="paymentWithPaymentAccount">
    <merchantID>B2BTestMerchant</merchantID>
    <shopID>AstropayCardDepositShop</shopID>
   <paymentMethod>
      <key>277</key>
      <value>AstropayCardRedirectRefund</value>
    </paymentMethod>
    <merchantTransactionID>abaed948-dbad-41e3-92dd-c2a8346a7aa3</merchantTransactionID>
    <paymentID>cbaa91d4-1e6a-4654-8563-b343cb3766bc</paymentID>
    <userID>41aaaee4-9077-4d8f-8751-88a44a</userID>
    <paymentProvider>
      <key>152</key>
      <value>Astropay</value>
    </paymentProvider>
    <amount currencyCode="BRL">10.0000</amount>
    <creationType>
      <key>2</key>
      <value>MerchantOperator</value>
    </creationType>
    <state>
      <id>a844a7c2-828c-481b-8f86-22069e79bfa9</id>
      <definition>
        <key>125</key>
        <value>Refunded</value>
      </definition>
      <createdOn>2017-09-18T11:53:47.81</createdOn>
      <paymentStateDetails xsi:nil="true" />
    </state>
    <isExecuted>true</isExecuted>
    <baseAmount currencyCode="EUR">2.6500</baseAmount>
    <paymentDetails>
      <detail xsi:type="keyStringValuePair">
        <key>ProviderExternalID</key>
        <value>cbaa91d4-1e6a-4654-8563-b343cb3766bc</value>
      </detail>
      <detail xsi:type="keyStringValuePair">
        <key>OriginalPaymentID</key>
        <value>abaed948-dbad-41e3-92dd-c2a8346a7aa3</value>
      </detail>
      <detail xsi:type="keyStringValuePair">
        <key>OriginalPaymentMerchantTransactionID</key>
        <value>05712e8d-45ec-408b-a822-0bd7a353e7d9</value>
      </detail>
      <detail xsi:type="keyStringValuePair">
        <key>OriginalPaymentMethodID</key>
        <value>236</value>
      </detail>
      <detail xsi:type="keyStringValuePair">
        <key>OriginalPaymentMethodName</key>
        <value>AstropayCardRedirectDeposit</value>
      </detail>
    </paymentDetails>
    <paymentAccount>
      <paymentAccountID>0</paymentAccountID>
    </paymentAccount>
  </payment>
</handlePaymentStateChangedNotificationRequest>

Astropay error codes

ProviderResponseCode

ProviderResponseMessage and Action

300

Invalid params + [param name] - Ask the user to re-enter the information related to that parameter.

301

Empty params + [param name] - The parameter must be included in the request and must not be empty. If the parameter contains information filled by the user, ask the user to fill the information. If the parameter is filled automatically on the merchant's side (x_login, x_trans_key, x_invoice, x_iduser or control), there is an integration error. Please include this parameter in the request.

302

Invalid control string - Integration problem. Control string instructions.

401

Invalid credentials - Integration problem. Check in the merchant's panel which are the correct credentials. Remember Sandbox and Production credentials are different.

402

Unregistered IP address - Whitelist the IP in the merchant's panel in the section Credentials & Settings. If there are no more fields, please contact us.

515

Invalid amount - Ask the user to re-enter the amount.

516

Invalid invoice - For functions: newInvoice and refund, it means the invoice already exists. For functions: payment status and refund status, it means the invoice was not found.

517

Invalid document number - Ask the user to re-enter his document.

520

Insufficient funds - The refund could not be processed due to insufficient funds. Contact us to increase the balance.