DreamPay API - Web Integration
Integrate DreamPay with your website to start accepting online payments from your customers holders of Brazilian credit cards.
Our standard checkout provides all the essential features for integrating DreamPay Checkout with the client-side of your application. This is available only for web-based integrations.
HTTPS-only
To stick with industry-standard security levels, the DreamPay API will not accept requests coming with unencrypted payloads (e.g. using the URL http://api.dreampay.com.br). Make sure your API client is configured to always use the https://api.dreampay.com.br URL.
1. Pre-requisites
In order to use the DreamPay API for web integration of DreamPay you need to have a partner account. If you still don't have one, please register at https://linkgenerator.dreampay.com.br
2. API URL's
- You can find the DreamPay API at https://api.dreampay.com.br/
- You can find the DreamPay API Open Api at https://api.dreampay.com.br/docs/
3. API authentication
The authentication is made by sending in the header of all requests the key "ApiKey" where the value is found on your account profile page.
4. Flow steps
a. Generate payment link
As a first step to integrate DreamPay payments in your checkout flow you need to generate a payment link by making a POST request to /api/PaymentLinks
{
"establishmentID": 1001,
"customerName": "Your customer name",
"customerEmail": "customer-email@gmail.com",
"customerPhoneNumber": "+351919191919 - optional",
"orderNumber": "136",
"value": 29.99,
"currencyCode": "EUR",
"observations": "Some description - optional",
"callbackUrl": "https://callbackurl.pt/endpoint - optional",
"returnUrl": "https://return.url - optional"
} The establishmentID is the 4 digit number that can be found in your contract, by checking the Terms and Conditions in your profile page.
b. Send customer to payment page
As a second step you should forward your customer to the payment link received in the previous step. You can open it in a modal window, an iframe or in a new window.
c. Display result of payment
The result of the payment is displayed in the DreamPay payment page. You can provide a returnUrl to forward the customer to a "Thank you" page or "My account" page to achieve a better user experience.
- You can check the status of the payment by making a GET request to /api/PaymentLinks/{id}
- You can provide a callbackUrl to receive a confirmation of the payment.
interface CallbackMessage {
apiKey: string;
paymentLink: string;
status: string;
message: string;
integrationId: string;
} You can get a list of all payment links that you generated by making a GET request to /api/PaymentLinks/establishment/{establishmentId}
5. Other methods available
a. List of payment links
You can get a list of all payment links that you generated by making a GET request to /api/PaymentLinks/establishment/{establishmentId}
b. Check payment link status
You can check the status of the payment by making a GET request to /api/PaymentLinks/{id}
6. Tests and Sandbox
- You can find the DreamPay API test environment at https://dev-api.dreampay.com.br
- You can find the DreamPay API test environment Open Api at https://dev-api.dreampay.com.br/docs/
- You can find the DreamPay Linkgenerator test environment at https://dev-linkgenerator.dreampay.com.br
Before accepting live payments, you can use the following test card numbers to test your integration.
These card numbers are only valid on our test platform, and will not result in a real transaction or transfer of funds.
| Flag | Type | Card Number | Expire Date | CID |
|---|---|---|---|---|
| Mastercard | Debit | 5277696455399733 | jan/35 | 123 |
| Mastercard | Credit | 5448280000000007 | jan/35 | 123 |
| Mastercard (BIN 2) | Debit | 2223000148400010 | jan/35 | 123 |
| Mastercard (BIN 2) | Credit | 2223020000000005 | jan/35 | 123 |
| Visa | Debit | 4761120000000148 | jan/35 | 123 |
| Visa | Credit | 4235647728025682 | jan/35 | 123 |
| Hipercard | Credit | 6062825624254001 | jan/35 | 123 |
| Hiper | Credit | 6370950847866501 | jan/35 | 123 |
| Diners | Credit | 36490101441625 | jan/35 | 123 |
| JCB | Credit | 3569990012290937 | jan/35 | 123 |
| JCB (19 dig) | Credit | 3572000100200142753 | jan/35 | 123 |
| Credz | Credit | 6367600001405019 | jan/35 | 123 |
| Elo | Credit | 4389351648020055 | jan/35 | 123 |
| Amex | Credit | 371341553758128 | jan/35 | 1234 |
| Cabal | Credit | 6042034400069940 | jan/35 | 123 |
| Sorocred | Credit | 6364142000000122 | jan/35 | 123 |
| Credsystem | Credit | 6280281038975334 | jan/35 | 123 |
| Banescard | Credit | 6031828795629272 | jan/35 | 123 |
Tokenized Test Cards
| Flag | Type | Card Number | Expire Date | CID | tokenCode | tokenCryptogram |
|---|---|---|---|---|---|---|
| Visa | Credit | 4895370010000005 | jan/35 | 123 | 4830442035272279 / 4830447374649789 / 4894093711004024 | AgAAAAAAAIR8CQrXSohbQAAAAAA= |
| Visa | Debit | 4824810010000006 | jan/35 | 123 | 4894092622280160 / 4894096020766258 / 4894094167345770 | AAABAkkREQAAAAAAAAAAAAAAAAA= |
| Mastercard (BIN 2) | Credit | 2223000250000004 | jan/35 | 123 | * | ANbuvvxnDbK2AAEShHMWGgADFA== |
| Mastercard (BIN 2) | Debit | 5204970000000007 | jan/35 | 123 | * | AOPAIMgflr8UAAIShHMWGgADFA== |
3DS Test Cards
| Card Number | Expiry Date | CID |
|---|---|---|
| 4110110043597521 | 03/2030 | 123 |
| 370000000000002 | 03/2030 | 7373 |
| 4003550000000003 | 03/2030 | 737 |
| 4360000001000005 | 03/2030 | 737 |
| 4166676667666746 | 03/2030 | 737 |
| 4000620000000007 | 03/2030 | 737 |
| 4293189100000008 | 03/2030 | 737 |
| 6703444444444449 | 03/2030 | 797 |
To simulate error codes, simply send transactions with the values corresponding to the error codes, as shown in the table below:
| Error Code | Amount | Return Message |
|---|---|---|
| 53 | 53 | Transaction not allowed for the issuer. Contact Rede. |
| 56 | 56 | Error in reported data. Try again. |
| 57 | 57 | affiliation: Invalid merchant. |
| 58 | 58 | Unauthorized. Contact issuer. |
| 69 | 69 | Transaction not allowed for this product or service. |
| 72 | 72 | Contact issuer. |
| 74 | 74 | Communication failure. Try again. |
| 79 | 79 | Expired card. Transaction cannot be resubmitted. Contact issuer. |
| 80 | 80 | Unauthorized. Contact issuer. (Insufficient funds). |
| 83 | 83 | Unauthorized. Contact issuer. |
| 84 | 84 | Unauthorized. Transaction cannot be resubmitted. Contact issuer. |
| 100 | 100 | Please contact issuer. |
| 101 | 101 | Unauthorized. Problems on the card, contact the issuer. |
| 102 | 102 | Unauthorized. Check the situation of the store with the issuer. |
| 103 | 103 | Unauthorized. Please try again. |
| 104 | 104 | Unauthorized. Please try again. |
| 105 | 105 | Unauthorized. Restricted card. |
| 106 | 106 | Error in issuer processing. Please try again. |
| 108 | 108 | Unauthorized. Value not allowed for this type of card. |
| 109 | 109 | Unauthorized. Nonexistent card. |
| 110 | 110 | Unauthorized. Transaction type not allowed for this card. |
| 111 | 111 | Unauthorized. Insufficient funds. |
| 112 | 112 | Unauthorized. Expiry date expired. |
| 113 | 113 | Unauthorized. Identified moderate risk by the issuer. |
| 114 | 114 | Unauthorized. The card does not belong to the payment network. |
| 115 | 115 | Unauthorized. Exceeded the limit of transactions allowed in the period. |
| 116 | 116 | Unauthorized. Please contact the Card Issuer. |
| 117 | 117 | Transaction not found. |
| 118 | 118 | Unauthorized. Card locked. |
| 119 | 119 | Unauthorized. Invalid security code. |
| 121 | 121 | Error processing. Please try again. |
| 122 | 122 | Transaction previously sent. |
| 123 | 123 | Unauthorized. Bearer requested the end of the recurrences in the issuer. |
| 124 | 124 | Unauthorized. Contact Rede. |
| 204 | 204 | Cardholder not registered in the issuer's authentication program. |
| 899 | 899 | Unsuccessful. Please contact Rede. |
| 3025 | 3025 | Deny Category 01: This card should not be used |
| 3026 | 3026 | Deny Category 02: This card should not be used in this PV |
| 3027 | 3027 | Deny Category 03: No cards must be used in this PV |
Return Message
The following table shows the Transaction Statuses, that are defined by the FINAL NUMBER of each card, and the ReturnCode:
| End of Card | Transaction Status | Return Message |
|---|---|---|
| XXXX.XXXX.XXXX.XXX0 | 200 | Payment made successfully |
| XXXX.XXXX.XXXX.XXX1 | 200 | Payment made successfully |
| XXXX.XXXX.XXXX.XXX4 | 200 | Payment made successfully |
| XXXX.XXXX.XXXX.XXX2 | 400 | Not Allowed |
| XXXX.XXXX.XXXX.XXX3 | 400 | Expire Card |
| XXXX.XXXX.XXXX.XXX5 | 400 | Blocked Card |
| XXXX.XXXX.XXXX.XXX6 | 400 | Time Out |
| XXXX.XXXX.XXXX.XXX7 | 400 | Card Canceled |
| XXXX.XXXX.XXXX.XXX8 | 400 | Credit Card Problems |
Test card 4110.1100.4359.7521, for example, will simulate "Payment made successfully".
Attention: The sandbox environment evaluates the format and the end of the card. If a real card is sent, the result of the operation will be identical to that described in the above table.