PIX - Withdrawal (via Directa24)
Provider directa24 (Astropay) offers bank transfer withdrawal for various countries in Latin America.
This page describes a the Brazilianpayment method PIX withdrawal.
It is possible to conduct PIX withdrawal with PIX details or with bank details.
PIX withdrawal with PIX details
The following method IDs are covered in this section:
ID | Name | Credit/Debit State |
---|---|---|
265 | AstropayBankTransferWithdrawal | WithdrawnByProvider |
Payment method interaction type: Sychronous execution (see Interaction Types).
Payments are submitted to directa24 - when being submitted successfully, the state is updated to InitiatedByProvider, else to WithdrawErrorReportedByProvider for an error or to RefusedByProvider for a rejected payment. In the later case, the values ProviderErrorMessage and _ProviderErrorCode_are logged.
Submitted payments are sent by directa24 to the bank. Once they are confirmed by the bank, directa24 sends a notification to PXP Financial. PXP Financial queries the provider system for the status of the payment and update the payment state on PXP Financial side.
Backend2BackendIntegration
The following table contains the fields to be sent in the initiatePaymentRequest.specificPaymentAccountData xml section:
key (value type, account type, required) | value |
---|---|
CurrencyCode (string, required) | currency code, e.g. BRL |
BankCountryCode2 (string, required) | country code, e.g. BR |
AccountNumber (string) | Bank account number. For PIX Withdrawal please omit this field. |
BankSortCode (string, required) | Bank code PIX Key Phone - 10000 PIX Key Email - 10001 PIX Key Document - 10002 |
AccountOwnerAddress (string, optional) | Address of bank account owner (optional) |
AccountOwner (string) | Account owner name |
AccountType (string, required) | Mandatory, but can have any value: "C" (Checkings account) or "S" (Savings account) or "O" (Joint checkings) or "P" (Joint savings account) |
The following parameters can be provided in initiatePaymentRequest.specificPaymentData:
key (value type, account type, required) | value |
---|---|
PaymentProviderID (Int) | Provider ID - default value 152 |
UserFirstName (string) | Beneficiary´s first name |
UserLastName (string) | Beneficiary´s last name |
The following parameters have to passed in initiatePaymentRequest.UserData:
key (value type, account type, required) | value |
---|---|
identificationNumber (string, required) | Identification number The identification number is sent as the PIX key if PIX Key document (10002) is sent in the BankSortCode field. |
telephoneNumber (string, within address section) | Please pass the telephone number if PIX Phone (10000) is used. |
email (sting) | Please pass the eMail address if PIX eMail (10001) is used. |
Data Validation
PIX Key Phone (1000) | AccountNumber to be omitted. AccountType can have any value. The field _telephoneNumber _within userData has to be sent. |
PIX Key eMail (10001) | AccountNumber to be omitted. AccountType can have any value. The field eMail within userData has to be sent. |
PIX Key Document (10002) | AccountNumber to be omitted. AccountType can have any value. The field identificationNumber within userData has to be sent. |
Requests/Responses
Example initiatePaymentRequest (for PIX Document (10002)):
<initiatePaymentRequest xmlns="http://www.cqrpayments.com/PaymentProcessing"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<merchantID>merchant</merchantID>
<shopID>shop</shopID>
<merchantTransactionID>hctest0020135116</merchantTransactionID>
<paymentMethodID>265</paymentMethodID>
<amount currencyCode="BRL">4000</amount>
<userID>55517534-06</userID>
<userData>
<username>pp_ppboleto7-06</username>
<firstname>PPPPBOLETOFN</firstname>
<lastname>PPPPBOLETOLN</lastname>
<email>[email protected]</email>
<address>
<street>Address</street>
<houseName>Address</houseName>
<postalCode>447475</postalCode>
<state>State</state>
<countryCode2>BR</countryCode2>
</address>
<dateOfBirth>1940-03-08T00:00:00</dateOfBirth>
<identificationNumber>76939737537</identificationNumber>
<identificationNumberType>CPF</identificationNumberType>
</userData>
<userIP>10.8.60.57</userIP>
<userSessionID>53603066</userSessionID>
<creationTypeID>1</creationTypeID>
<specificPaymentData>
<data xsi:type="keyStringValuePair">
<key>UserFirstname</key>
<value>PPPPBOLETOFN</value>
</data>
<data xsi:type="keyStringValuePair">
<key>UserLastname</key>
<value>PPPPBOLETOLN</value>
</data>
<data xsi:type="keyStringValuePair">
<key>UserCountryCode2</key>
<value>BR</value>
</data>
<data xsi:type="keyIntValuePair">
<key>PaymentProviderID</key>
<value>152</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>BankSortCode</key>
<value>10002</value>
</data>
<data xsi:type="keyStringValuePair">
<key>AccountType</key>
<value>C</value>
</data>
</specificPaymentAccountData>
</paymentAccount>
</initiatePaymentRequest>
Example initiatePaymentResponse (for PIX Document (10002)):
<initiatePaymentResponse xmlns="http://www.cqrpayments.com/PaymentProcessing" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<payment xsi:type="paymentWithPaymentAccount">
<merchantID>merchant</merchantID>
<shopID>shop</shopID>
<paymentMethod>
<key>265</key>
<value>AstropayBankTransferWithdrawal</value>
</paymentMethod>
<merchantTransactionID>hctest0020135126</merchantTransactionID>
<paymentID>c5e1e249-c0c3-4994-9c51-f757f66c65fc</paymentID>
<userID>55517534-26</userID>
<paymentProvider>
<key>152</key>
<value>Astropay</value>
</paymentProvider>
<amount currencyCode="BRL">4000</amount>
<creationType>
<key>1</key>
<value>User</value>
</creationType>
<userIP>10.8.60.57</userIP>
<state>
<id>b9635622-26fc-4494-813e-251a4ceca04e</id>
<definition>
<key>3</key>
<value>InitiatedByProvider</value>
</definition>
<createdOn>2021-07-20T08:52:12.749459Z</createdOn>
<paymentStateDetails>
<detail xsi:type="keyStringValuePair">
<key>ProviderResponseMessage</key>
<value>OK</value>
</detail>
<detail xsi:type="keyStringValuePair">
<key>PaymentStateReasonID</key>
<value>1</value>
</detail>
</paymentStateDetails>
</state>
<isExecuted>false</isExecuted>
<baseAmount currencyCode="EUR">1437.41</baseAmount>
<paymentDetails>
<detail xsi:type="keyStringValuePair">
<key>UserFirstname</key>
<value>PPPPBOLETOFN</value>
</detail>
<detail xsi:type="keyStringValuePair">
<key>UserLastname</key>
<value>PPPPBOLETOLN</value>
</detail>
<detail xsi:type="keyStringValuePair">
<key>ProviderTransactionID</key>
<value>80367</value>
</detail>
<detail xsi:type="keyStringValuePair">
<key>ProviderExternalID</key>
<value>9155</value>
</detail>
</paymentDetails>
<paymentAccount>
<paymentAccountID>db1f7927-d101-48d9-b18e-b33c8ab18bf3</paymentAccountID>
</paymentAccount>
</payment>
</initiatePaymentResponse>
Example initiatePaymentRequest (for PIX eMail (10001)):
<initiatePaymentRequest xmlns="http://www.cqrpayments.com/PaymentProcessing"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<merchantID>merchant</merchantID>
<shopID>shop</shopID>
<merchantTransactionID>hctest0020135127</merchantTransactionID>
<paymentMethodID>265</paymentMethodID>
<amount currencyCode="BRL">4000</amount>
<userID>55517534-27</userID>
<userData>
<username>pp_ppboleto7-27</username>
<firstname>PPPPBOLETOFN</firstname>
<lastname>PPPPBOLETOLN</lastname>
<email>[email protected]</email>
<address>
<street>Address</street>
<houseName>Address</houseName>
<postalCode>447475</postalCode>
<state>State</state>
<countryCode2>BR</countryCode2>
</address>
<dateOfBirth>1940-03-08T00:00:00</dateOfBirth>
<identificationNumber>36538052363</identificationNumber>
</userData>
<userIP>10.8.60.57</userIP>
<userSessionID>5360306727</userSessionID>
<creationTypeID>1</creationTypeID>
<specificPaymentData>
<data xsi:type="keyStringValuePair">
<key>UserFirstname</key>
<value>PPPPBOLETOFN</value>
</data>
<data xsi:type="keyStringValuePair">
<key>UserLastname</key>
<value>PPPPBOLETOLN</value>
</data>
<data xsi:type="keyStringValuePair">
<key>UserCountryCode2</key>
<value>BR</value>
</data>
<data xsi:type="keyIntValuePair">
<key>PaymentProviderID</key>
<value>152</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>BankSortCode</key>
<value>10001</value>
</data>
<data xsi:type="keyStringValuePair">
<key>AccountType</key>
<value>C</value>
</data>
</specificPaymentAccountData>
</paymentAccount>
</initiatePaymentRequest>
Example initiatePaymentResponse (for PIX Email (10001)):
<initiatePaymentResponse xmlns="http://www.cqrpayments.com/PaymentProcessing" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<payment xsi:type="paymentWithPaymentAccount">
<merchantID>merchant</merchantID>
<shopID>shop</shopID>
<paymentMethod>
<key>265</key>
<value>AstropayBankTransferWithdrawal</value>
</paymentMethod>
<merchantTransactionID>hctest0020135127</merchantTransactionID>
<paymentID>74933973-b902-4852-ad0a-696d75867bfd</paymentID>
<userID>55517534-27</userID>
<paymentProvider>
<key>152</key>
<value>Astropay</value>
</paymentProvider>
<amount currencyCode="BRL">4000</amount>
<creationType>
<key>1</key>
<value>User</value>
</creationType>
<userIP>10.8.60.57</userIP>
<state>
<id>6f20e5fb-5687-4b2a-9c04-2ecc52859a61</id>
<definition>
<key>3</key>
<value>InitiatedByProvider</value>
</definition>
<createdOn>2021-07-20T08:54:45.5309995Z</createdOn>
<paymentStateDetails>
<detail xsi:type="keyStringValuePair">
<key>ProviderResponseMessage</key>
<value>OK</value>
</detail>
<detail xsi:type="keyStringValuePair">
<key>PaymentStateReasonID</key>
<value>1</value>
</detail>
</paymentStateDetails>
</state>
<isExecuted>false</isExecuted>
<baseAmount currencyCode="EUR">1437.41</baseAmount>
<paymentDetails>
<detail xsi:type="keyStringValuePair">
<key>UserFirstname</key>
<value>PPPPBOLETOFN</value>
</detail>
<detail xsi:type="keyStringValuePair">
<key>UserLastname</key>
<value>PPPPBOLETOLN</value>
</detail>
<detail xsi:type="keyStringValuePair">
<key>ProviderTransactionID</key>
<value>80368</value>
</detail>
<detail xsi:type="keyStringValuePair">
<key>ProviderExternalID</key>
<value>9157</value>
</detail>
</paymentDetails>
<paymentAccount>
<paymentAccountID>d437708a-dc6b-41c6-aae8-93e5c0fce78c</paymentAccountID>
</paymentAccount>
</payment>
</initiatePaymentResponse>
Example initiatePaymentRequest (for PIX phone (10000)):
<initiatePaymentRequest xmlns="http://www.cqrpayments.com/PaymentProcessing"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<merchantID>merchant</merchantID>
<shopID>shop</shopID>
<merchantTransactionID>hctest0020135129</merchantTransactionID>
<paymentMethodID>265</paymentMethodID>
<amount currencyCode="BRL">4000</amount>
<userID>55517534-29</userID>
<userData>
<username>pp_ppboleto7-29</username>
<firstname>PPPPBOLETOFN</firstname>
<lastname>PPPPBOLETOLN</lastname>
<address>
<street>Address</street>
<houseName>Address</houseName>
<postalCode>447475</postalCode>
<state>State</state>
<countryCode2>BR</countryCode2>
<telephoneNumber>099123456</telephoneNumber>
</address>
<dateOfBirth>1942-03-08T00:00:00</dateOfBirth>
<identificationNumber>67509561221</identificationNumber>
</userData>
<userIP>10.8.60.57</userIP>
<userSessionID>5360306929</userSessionID>
<creationTypeID>1</creationTypeID>
<specificPaymentData>
<data xsi:type="keyStringValuePair">
<key>UserFirstname</key>
<value>PPPPBOLETOFN</value>
</data>
<data xsi:type="keyStringValuePair">
<key>UserLastname</key>
<value>PPPPBOLETOLN</value>
</data>
<data xsi:type="keyStringValuePair">
<key>UserCountryCode2</key>
<value>BR</value>
</data>
<data xsi:type="keyIntValuePair">
<key>PaymentProviderID</key>
<value>152</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>BankSortCode</key>
<value>10000</value>
</data>
<data xsi:type="keyStringValuePair">
<key>AccountType</key>
<value>C</value>
</data>
</specificPaymentAccountData>
</paymentAccount>
</initiatePaymentRequest>
Example initiatePaymentResponse (for PIX phone (10000)):
<initiatePaymentResponse xmlns="http://www.cqrpayments.com/PaymentProcessing" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<payment xsi:type="paymentWithPaymentAccount">
<merchantID>merchant</merchantID>
<shopID>shop</shopID>
<paymentMethod>
<key>265</key>
<value>AstropayBankTransferWithdrawal</value>
</paymentMethod>
<merchantTransactionID>hctest0020135129</merchantTransactionID>
<paymentID>0d10af7d-0b24-4b4c-95c4-c6d6476024ae</paymentID>
<userID>55517534-29</userID>
<paymentProvider>
<key>152</key>
<value>Astropay</value>
</paymentProvider>
<amount currencyCode="BRL">4000</amount>
<creationType>
<key>1</key>
<value>User</value>
</creationType>
<userIP>10.8.60.57</userIP>
<state>
<id>340b747c-7ff9-4e32-bd96-f58cf0b16bbf</id>
<definition>
<key>3</key>
<value>InitiatedByProvider</value>
</definition>
<createdOn>2021-07-20T08:56:33.6405937Z</createdOn>
<paymentStateDetails>
<detail xsi:type="keyStringValuePair">
<key>ProviderResponseMessage</key>
<value>OK</value>
</detail>
<detail xsi:type="keyStringValuePair">
<key>PaymentStateReasonID</key>
<value>1</value>
</detail>
</paymentStateDetails>
</state>
<isExecuted>false</isExecuted>
<baseAmount currencyCode="EUR">1437.41</baseAmount>
<paymentDetails>
<detail xsi:type="keyStringValuePair">
<key>UserFirstname</key>
<value>PPPPBOLETOFN</value>
</detail>
<detail xsi:type="keyStringValuePair">
<key>UserLastname</key>
<value>PPPPBOLETOLN</value>
</detail>
<detail xsi:type="keyStringValuePair">
<key>ProviderTransactionID</key>
<value>80370</value>
</detail>
<detail xsi:type="keyStringValuePair">
<key>ProviderExternalID</key>
<value>9158</value>
</detail>
</paymentDetails>
<paymentAccount>
<paymentAccountID>22759655-0b20-4bb9-b510-f12dcde9268d</paymentAccountID>
</paymentAccount>
</payment>
</initiatePaymentResponse>
The payment can reach one of the following states in the initiatePaymentResponse:
Payment States | Description |
---|---|
InitiatedByProvider | Intermediate state denoting a successful payment submission at provider |
WithdrawalErrorReportedByProvider | Error state due to failed payment submission at provider; errors are logged in the PaymentStateAdditionalDetails fields ProviderErrorCode and ProviderErrorMessage |
RefusedByProvider | Error state for a rejected payment; errors are logged in the PaymentStateAdditionalDetails field ProviderReturnCode |
InitiatePaymentRequest and -response leading to WithdrawalErrorReportedByProvider:
<initiatePaymentRequest xmlns="http://www.cqrpayments.com/PaymentProcessing"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<merchantID>merchant</merchantID>
<shopID>shop</shopID>
<merchantTransactionID>hctest00201351331</merchantTransactionID>
<paymentMethodID>265</paymentMethodID>
<amount currencyCode="BRL">40</amount>
<userID>55517534-33</userID>
<userData>
<username>pp_ppboleto7-33</username>
<firstname>PPPPBOLETOFN</firstname>
<lastname>PPPPBOLETOLN</lastname>
<email>[email protected]</email>
<address>
<street>Address</street>
<houseName>Address</houseName>
<postalCode>447475</postalCode>
<state>State</state>
<countryCode2>BR</countryCode2>
</address>
<dateOfBirth>1940-03-08T00:00:00</dateOfBirth>
</userData>
<userIP>10.8.60.57</userIP>
<userSessionID>5360306727</userSessionID>
<creationTypeID>1</creationTypeID>
<specificPaymentData>
<data xsi:type="keyStringValuePair">
<key>UserFirstname</key>
<value>PPPPBOLETOFN</value>
</data>
<data xsi:type="keyStringValuePair">
<key>UserLastname</key>
<value>PPPPBOLETOLN</value>
</data>
<data xsi:type="keyStringValuePair">
<key>UserCountryCode2</key>
<value>BR</value>
</data>
<data xsi:type="keyIntValuePair">
<key>PaymentProviderID</key>
<value>152</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>BankSortCode</key>
<value>10001</value>
</data>
<data xsi:type="keyStringValuePair">
<key>AccountType</key>
<value>C</value>
</data>
</specificPaymentAccountData>
</paymentAccount>
</initiatePaymentRequest>
<initiatePaymentResponse xmlns="http://www.cqrpayments.com/PaymentProcessing" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<payment xsi:type="paymentWithPaymentAccount">
<merchantID>merchant</merchantID>
<shopID>shop</shopID>
<paymentMethod>
<key>265</key>
<value>AstropayBankTransferWithdrawal</value>
</paymentMethod>
<merchantTransactionID>hctest00201351331</merchantTransactionID>
<paymentID>bb464cb9-edcd-4bcf-a48a-d5fea089e48b</paymentID>
<userID>55517534-33</userID>
<paymentProvider>
<key>152</key>
<value>Astropay</value>
</paymentProvider>
<amount currencyCode="BRL">40</amount>
<creationType>
<key>1</key>
<value>User</value>
</creationType>
<userIP>10.8.60.57</userIP>
<state>
<id>1dc2b2fb-b04b-457e-90bd-f47c9225a784</id>
<definition>
<key>21</key>
<value>WithdrawErrorReportedByProvider</value>
</definition>
<createdOn>2021-09-20T14:52:51.8880048Z</createdOn>
<description>Unexpected status '1' received from the provider. Expected results are 0 (Initiated), 3 (Refused).</description>
<paymentStateDetails>
<detail xsi:type="keyStringValuePair">
<key>ProviderErrorMessage</key>
<value>Invalid document</value>
</detail>
<detail xsi:type="keyStringValuePair">
<key>ProviderErrorCode</key>
<value>300</value>
</detail>
<detail xsi:type="keyStringValuePair">
<key>PaymentStateReasonID</key>
<value>1</value>
</detail>
</paymentStateDetails>
</state>
<isExecuted>false</isExecuted>
<baseAmount currencyCode="EUR">14.37</baseAmount>
<paymentDetails>
<detail xsi:type="keyStringValuePair">
<key>UserFirstname</key>
<value>PPPPBOLETOFN</value>
</detail>
<detail xsi:type="keyStringValuePair">
<key>UserLastname</key>
<value>PPPPBOLETOLN</value>
</detail>
<detail xsi:type="keyStringValuePair">
<key>ProviderExternalID</key>
<value>9811</value>
</detail>
</paymentDetails>
<paymentAccount>
<paymentAccountID>0fa77e57-ac28-4508-b4a8-db69118a900d</paymentAccountID>
</paymentAccount>
</payment>
</initiatePaymentResponse>
Submitted payments are sent by directa24 to the bank through the PIX system. Once they are confirmed, directa24 sends a notification to PXP Financial. PXP Financial queries the provider system for the status of the payment and update the payment state on PXP Financial side.
An AstropayBankTransferWithdrawal payment of PIX will have the following flow :
PENDING (state InitiatedByProvider) => DELIVERED (state PendingOnProvider) => CONFIRMED (state WithdrawnByProvider) or REJECTED (state RefusedByProvider).
Payment States | Description |
---|---|
PendingOnProvider | A withdrawal payment has been sent to provider ("Delivered"), but not yet processed and it still can be rejected |
WithdrawnByProvider | Success state |
RefusedByProvider | Error state due to failed processing of payment; errors are logged in the PaymentStateAdditionalDetails fields ProviderErrorCode and ProviderErrorMessage |
QueryPaymentStateErrorReportedByProvider | When PXP Financial receives a state change notification from provider directa24, the state of the payment is being queried against provider. When an error occurs, errors are logged in the PaymentStateAdditionalDetails fields ProviderErrorCode and ProviderErrorMessage |
PIX withdrawal with bank data
The following data needs to be sent in the initiatePaymentRequest.specificPaymentAccountData section:
key (value type, required) | Description |
---|---|
CurrencyCode (string) | Currency code BRL |
BankCountryCode2 (string, mandatory) | Country code BR |
AccountNumber (string, mandatory) | Bank account number |
BranchCode (string, mandatory) | Bank branch code |
BankSortCode (string, mandatory) | Bank code; pass either the 3 digit bank code or the ISPB here |
AccountOwnerAddress (string) | Address of bank account owner |
AccountOwner (string) | Account owner name |
AccountType (string, mandatory) | Account type value, C (Checking) or S (Savings) |
The following paramaters should be sent in initiatePaymentRequest.specificPaymentData:
key (value type, required) | Description |
---|---|
PaymentProviderID (int, required) | ProviderID 152 |
UserFirstName (string, required) | Beneficiary´s first name (user first name) |
UserLastName (string, required) | Beneficiary´s last name (user last name) |
The following parameters have to be passed in initiatePaymentRequest.UserData:
key (value type, required) | Description |
---|---|
identificationNumber (string, required) | Identification number (CPF), |
identificationNumberType (string, optional) | Set to "CPF" |
Example initiatePaymentRequest:
<?xml version="1.0" encoding="utf-8"?>
<initiatePaymentRequest xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://www.cqrpayments.com/PaymentProcessing">
<merchantID>B2BTestMerchant</merchantID>
<shopID>AstropayCardBankTransferWithdrawalShop</shopID>
<merchantTransactionID>5f366a56-a394-4ab2-aac3-f4174ba716d8-21</merchantTransactionID>
<paymentMethodID>265</paymentMethodID>
<amount currencyCode="BRL">10.01</amount>
<userID>12eadca3-0d87-4144-a75e-10ea70</userID>
<userData>
<username>061bb617-bbe8-4aa4-b896-8b06949e653b</username>
<firstname>Edson</firstname>
<lastname>Arantes do Nascimento</lastname>
<currencyCode xsi:nil="true" />
<languageCode xsi:nil="true" />
<email xsi:nil="true" />
<address>
<street>Street</street>
<houseName xsi:nil="true" />
<houseNumber>1</houseNumber>
<houseNumberExtension xsi:nil="true" />
<postalCode>11300</postalCode>
<city>Sao Paulo</city>
<state xsi:nil="true" />
<countryCode2>BR</countryCode2>
<telephoneNumber>099123456</telephoneNumber>
</address>
<dateOfBirth>1955-02-15T00:00:00</dateOfBirth>
<identificationNumber>1234567890</identificationNumber>
<identificationNumberType>1</identificationNumberType>
</userData>
<userIP>127.0.0.1</userIP>
<userSessionID>a59a22cd-6178-4125-b966-188ff1a61181</userSessionID>
<creationTypeID>1</creationTypeID>
<specificPaymentData>
<data xsi:type="keyStringValuePair">
<key>UserFirstname</key>
<value>John</value>
</data>
<data xsi:type="keyStringValuePair">
<key>UserLastname</key>
<value>Doe</value>
</data>
<data xsi:type="keyIntValuePair">
<key>PaymentProviderID</key>
<value>152</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>7197</value>
</data>
<data xsi:type="keyStringValuePair">
<key>AccountOwner</key>
<value>Edson Arantes do Nascimento</value>
</data>
<data xsi:type="keyStringValuePair">
<key>BankSortCode</key>
<value>033</value>
</data>
<data xsi:type="keyStringValuePair">
<key>AccountOwnerAddress</key>
<value>1225 Bonavita St.</value>
</data>
<data xsi:type="keyStringValuePair">
<key>AccountType</key>
<value>1</value>
</data>
</specificPaymentAccountData>
</paymentAccount>
</initiatePaymentRequest>
Example initiatePaymentResponse:
<initiatePaymentResponse xmlns="http://www.cqrpayments.com/PaymentProcessing" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<payment xsi:type="paymentWithPaymentAccount">
<merchantID>B2BTestMerchant</merchantID>
<shopID>AstropayCardBankTransferWithdrawalShop</shopID>
<paymentMethod>
<key>265</key>
<value>AstropayBankTransferWithdrawal</value>
</paymentMethod>
<merchantTransactionID>5f366a56-a394-4ab2-aac3-f4174ba716d8-21</merchantTransactionID>
<paymentID>cf976b7d-3711-441d-b38a-5f8c6a6becd1</paymentID>
<userID>12eadca3-0d87-4144-a75e-10ea70</userID>
<paymentProvider>
<key>152</key>
<value>Astropay</value>
</paymentProvider>
<amount currencyCode="BRL">10.01</amount>
<creationType>
<key>1</key>
<value>User</value>
</creationType>
<userIP>127.0.0.1</userIP>
<state>
<id>60425692-feae-47bb-b699-7b4ae6081c23</id>
<definition>
<key>3</key>
<value>InitiatedByProvider</value>
</definition>
<createdOn>2017-11-09T08:43:33.7735125Z</createdOn>
<description>OK</description>
<paymentStateDetails>
<detail xsi:type="keyStringValuePair">
<key>ProviderResponseMessage</key>
<value>OK</value>
</detail>
<detail xsi:type="keyStringValuePair">
<key>PaymentStateReasonID</key>
<value>1</value>
</detail>
</paymentStateDetails>
</state>
<isExecuted>false</isExecuted>
<baseAmount currencyCode="EUR">2.66</baseAmount>
<paymentDetails>
<detail xsi:type="keyStringValuePair">
<key>UserFirstname</key>
<value>John</value>
</detail>
<detail xsi:type="keyStringValuePair">
<key>UserLastname</key>
<value>Doe</value>
</detail>
<detail xsi:type="keyStringValuePair">
<key>ProviderExternalID</key>
<value>cf976b7d-3711-441d-b38a-5f8c6a6becd1</value>
</detail>
<detail xsi:type="keyStringValuePair">
<key>ProviderTransactionID</key>
<value>e9d14450-20db-4304-b55d-a652953f7976</value>
</detail>
</paymentDetails>
<paymentAccount>
<paymentAccountID>541885ca-1f5b-4f16-be70-62cd9cb973a5</paymentAccountID>
</paymentAccount>
</payment>
</initiatePaymentResponse>
The payment can reach one of the following states in the initiatePaymentResponse:
Payment State | Description |
---|---|
InitiatedByProvider | Intermediate state denoting a successful payment submission at provider |
WithdrawalErrorReportedByProvider | Error state due to failed payment submission at provider; errors are logged in the PaymentStateAdditionalDetails fields ProviderErrorCode and ProviderErrorMessage Example: ProviderErrorCode "515" and ProviderErrorMessage "Invalid user status: BLACKLISTED" |
RefusedByProvider | Error state for a rejected payment; errors are logged in the PaymentStateAdditionalDetails field ProviderReturnCode |
Notifications
The standard notification mechanism is used for notifying the merchant in the background (asynchronously) about payment state changes. For more information see PaymentStateChangedNotification.
Example handlePaymentStateChangedNotificationRequest for WithdrawnByProvider:
<handlePaymentStateChangedNotificationRequest 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>AstropayCardBankTransferWithdrawalShop</shopID>
<paymentMethod>
<key>265</key>
<value>AstropayBankTransferWithdrawal</value>
</paymentMethod>
<merchantTransactionID>17593196-f44f-4b1e-92e8-474d8e88710d</merchantTransactionID>
<paymentID>c2c83321-1466-4af7-bde3-d84418f9b991</paymentID>
<userID>12b140b5-35ee-4a83-9f87-9d4405</userID>
<paymentProvider>
<key>152</key>
<value>Astropay</value>
</paymentProvider>
<amount currencyCode="BRL">10.0000</amount>
<creationType>
<key>1</key>
<value>User</value>
</creationType>
<userIP>127.0.0.1</userIP>
<state>
<id>6ca51370-bac8-42da-8121-1627a34289cd</id>
<definition>
<key>20</key>
<value>WithdrawnByProvider</value>
</definition>
<createdOn>2017-09-08T09:58:29.783</createdOn>
<paymentStateDetails>
<detail xsi:type="keyStringValuePair">
<key>ProviderResponseMessage</key>
<value>Completed</value>
</detail>
</paymentStateDetails>
</state>
<isExecuted>true</isExecuted>
<baseAmount currencyCode="EUR">2.6500</baseAmount>
<paymentDetails>
<detail xsi:type="keyStringValuePair">
<key>ProviderExternalID</key>
<value>c2c83321-1466-4af7-bde3-d84418f9b991</value>
</detail>
<detail xsi:type="keyStringValuePair">
<key>BankReferenceID</key>
<value>513512.04198.5</value>
</detail>
<detail xsi:type="keyStringValuePair">
<key>ProviderTransactionID</key>
<value>8ef0c159-966e-43e1-a0ba-62661d72fc47</value>
</detail>
</paymentDetails>
<paymentAccount>
<paymentAccountID>d52b9f0e-55b3-4011-a5e7-3935c6388958</paymentAccountID>
</paymentAccount>
</payment>
</handlePaymentStateChangedNotificationRequest>
Example handlePaymentStateChangedRequest for QueryPaymentStateErrorReportedByProvider:
<handlePaymentStateChangedNotificationRequest 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>AstropayCardBankTransferWithdrawalShop</shopID>
<paymentMethod>
<key>265</key>
<value>AstropayBankTransferWithdrawal</value>
</paymentMethod>
<merchantTransactionID>17593196-f44f-4b1e-92e8-474d8e88710d</merchantTransactionID>
<paymentID>c2c83321-1466-4af7-bde3-d84418f9b991</paymentID>
<userID>12b140b5-35ee-4a83-9f87-9d4405</userID>
<paymentProvider>
<key>152</key>
<value>Astropay</value>
</paymentProvider>
<amount currencyCode="BRL">10.0000</amount>
<creationType>
<key>1</key>
<value>User</value>
</creationType>
<userIP>127.0.0.1</userIP>
<state>
<id>6ca51370-bac8-42da-8121-1627a34289cd</id>
<definition>
<key>507</key>
<value>QueryPaymentStateErrorReportedByProvider</value>
</definition>
<createdOn>2017-09-08T09:58:29.783</createdOn>
</state>
<isExecuted>true</isExecuted>
<baseAmount currencyCode="EUR">2.6500</baseAmount>
<paymentDetails>
<detail xsi:type="keyStringValuePair">
<key>ProviderExternalID</key>
<value>32177540</value>
</detail>
<detail xsi:type="keyStringValuePair">
<key>ProviderTransactionID</key>
<value>11614940</value>
</detail>
</paymentDetails>
<paymentAccount>
<paymentAccountID>d52b9f0e-55b3-4011-a5e7-3935c6388958</paymentAccountID>
</paymentAccount>
</payment>
</handlePaymentStateChangedNotificationRequest>
**Example handlePaymentStateChangedRequest for RefusedByProvider:
<handlePaymentStateChangedNotificationRequest 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>AstropayCardBankTransferWithdrawalShop</shopID>
<paymentMethod>
<key>265</key>
<value>AstropayBankTransferWithdrawal</value>
</paymentMethod>
<merchantTransactionID>17593196-f44f-4b1e-92e8-474d8e88710d</merchantTransactionID>
<paymentID>c2c83321-1466-4af7-bde3-d84418f9b991</paymentID>
<userID>12b140b5-35ee-4a83-9f87-9d4405</userID>
<paymentProvider>
<key>152</key>
<value>Astropay</value>
</paymentProvider>
<amount currencyCode="BRL">10.0000</amount>
<creationType>
<key>1</key>
<value>User</value>
</creationType>
<userIP>127.0.0.1</userIP>
<state>
<id>6ca51310-bac8-42da-8121-1627a34289cd</id>
<definition>
<key>20</key>
<value>RefusedByProvider</value>
</definition>
<createdOn>2017-09-08T09:58:29.783</createdOn>
<paymentStateDetails>
<detail xsi:type="keyStringValuePair">
<key>ProviderResponseMessage</key>
<value>Rejected</value>
</detail>
<detail xsi:type="keyStringValuePair">
<key>ProviderStatusMessage</key>
<value>0</value>
</detail>
</paymentStateDetails>
</state>
<isExecuted>true</isExecuted>
<baseAmount currencyCode="EUR">2.6500</baseAmount>
<paymentDetails>
<detail xsi:type="keyStringValuePair">
<key>ProviderExternalID</key>
<value>32177540</value>
</detail>
<detail xsi:type="keyStringValuePair">
<key>ProviderTransactionID</key>
<value>11614940</value>
</detail>
</paymentDetails>
<paymentAccount>
<paymentAccountID>d52b9f0e-55b3-4011-a5e7-3935c6388958</paymentAccountID>
</paymentAccount>
</payment>
</handlePaymentStateChangedNotificationRequest>
Testing instructions
Identification Numbers for Astropay
Country | IdentificationNumber (sample values for testing) | Notes |
---|---|---|
Brasil | For CPF eg. 43656492484 | Please search online for "CPF generator" |
Returns
A new payment of type BankTransferWithdrawalReturn is created and merchant is notified.
The notification can be sent for payment method BankTransferWithdrawal with state ReturnedByProvider or for payment method BankTransferWithdrawalReturn with state ReturnedByProvider.
Sample notification with payment method BankTransferWithdrawal:
<?xml version="1.0" encoding="utf-8"?>
<handlePaymentStateChangedNotificationRequest xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://www.cqrpayments.com/PaymentProcessing">
<payment xsi:type="paymentWithPaymentAccount">
<merchantID>xxx</merchantID>
<shopID>xxx</shopID>
<paymentMethod>
<key>265</key>
<value>AstropayBankTransferWithdrawal</value>
</paymentMethod>
<merchantTransactionID>e2934084-ce2d-4d57-bd0f-81a0983fbf49</merchantTransactionID>
<paymentID>de6524a5-44c8-440e-8fb9-bda0ccf59301</paymentID>
<userID>f782088e-0d3e-402b-9143-359be4</userID>
<paymentProvider>
<key>152</key>
<value>Astropay</value>
</paymentProvider>
<amount currencyCode="BRL">10.0300</amount>
<creationType>
<key>1</key>
<value>User</value>
</creationType>
<state>
<id>434bae34-630a-4b6f-9c00-faa0c5c5adf2</id>
<definition>
<key>279</key>
<value>ReturnedByProvider</value>
</definition>
<createdOn>2021-04-07T15:40:31.79</createdOn>
<paymentStateDetails>
<detail xsi:type="keyStringValuePair">
<key>ProviderResponseMessage</key>
<value>Rejected</value>
</detail>
</paymentStateDetails>
</state>
<isExecuted>true</isExecuted>
<baseAmount currencyCode="EUR">2.6600</baseAmount>
<paymentDetails>
<detail xsi:type="keyStringValuePair">
<key>ProviderExternalID</key>
<value>de6524a5-44c8-440e-8fb9-bda0ccf59301</value>
</detail>
<detail xsi:type="keyIntValuePair">
<key>MerchantSettlementCurrencyID</key>
<value>2</value>
</detail>
<detail xsi:type="keyStringValuePair">
<key>OriginalPaymentID</key>
<value>de6524a5-44c8-440e-8fb9-bda0ccf59301</value>
</detail>
<detail xsi:type="keyStringValuePair">
<key>OriginalPaymentMerchantTransactionID</key>
<value>e2934084-ce2d-4d57-bd0f-81a0983fbf49</value>
</detail>
<detail xsi:type="keyStringValuePair">
<key>OriginalPaymentMethodID</key>
<value>265</value>
</detail>
<detail xsi:type="keyStringValuePair">
<key>OriginalPaymentMethodName</key>
<value>AstropayBankTransferWithdrawal</value>
</detail>
</paymentDetails>
<paymentAccount>
<paymentAccountID>1d9ca158-38ce-4270-8d53-cbab137254df</paymentAccountID>
</paymentAccount>
</payment>
</handlePaymentStateChangedNotificationRequest>
Updated 9 days ago