1. Sending Collections (API)
Send charges via email, ideal for generating charges unattended through third-party software or developing a module for an existing application.
1.1. Requirements and Preparation
To start, you need to have access to an account with Configure API
permissions or be the account administrator.
Note that you can use this integration in any code language that supports HTTP/S
queries or implement a library capable of using a Request
and Response
. type instance.
1.2. Key removal
In order to do this integration we will need to obtain the Key ID
and Secret Key
from our PixelPay platform which will be used later in the x-auth-key
and
x-auth-hash
fields.
1.2.1. Key ID field
The Key ID
field is a number that uniquely identifies the merchant and is a constant value, it cannot be changed.
1.2.2. Secret Key Field
The Secret Key
field is a 28-character alphanumeric value that can be generated at any time. Generating a new private key periodically increases security, but is optional for cases in which a third party possesses the key and is no longer necessary to grant access.
In order to extract the value of Key ID
and Secret Key
we will log in to the web platform and navigate in the left side menu to Preferences 〉API Options and we will find the field called Key ID
and Secret Key
.
NOTE:
TheSecret Key
value must be converted to an MD5 hash, the following application is recommended to perform this conversion: MD5 Hash Generator.
Image 1: Key ID and Secret Key in API Options.
In the following links you will find more information about:
- Log in:
https://pixelpay.zendesk.com/hc/es-419/articles/360041553012
- MD5 hash:
https://www.md5hashgenerator.com/
1.3. Use of keys
In order to generate automatic charges, it is necessary to have the business keys that will be used in the request headers
, along with Accept: Application/json, it is important that the Secret Key is not shared as shown in the application, since it can be exposed.
Headers
Accept: application/json
x-auth-key: 12345678
x-auth-hash: 8e68546db84c4aa7988085b6e0fa944c // MD5 del secret Key
1.4. Field Index
All fields must be sent as parameters in the HTTPS
query in Query String
format or include thecontent-type: x-www-form-urlencoded
format type in the header
.
The fields to be used are:
Campo | Valor | Validación | Descripción |
subject * |
Texto corto | Required, min:3, max:120 | Email subject or charge description |
name * |
Texto corto | Required, min:3, max:120 | Customer's full name |
email * |
usuario@dominio.com | Required, email | Customer's email address |
amount * |
0.00 | Required, doublé | Total amount of the charge in currency |
tax_amount |
0.00 | Optional, doublé, lower than amount |
Total amount of tax in currency |
note |
Texto mediano | Optional, text, min:3, max:160 | Note to include in the charge |
currency |
USD/HNL | Optional, size:3, uppercase | Currency in which the charge will be made |
user_email |
usuario@dominio.com | Optional, email | Email of the user or employee generating the charge |
expired_at |
yyyy/mm/dd hh:mm | Optional, date | Payment expiration date, if no time is specified, the payment will expire at 23:59 on the day sent. |
attach |
... | Optional, file, max:2000kb | Attached file type: PDF/Word/Excel |
extras |
{key:"value", ...} | Optional, JSON | Additional content as parameters for response use in webhook |
content |
{[key:"value",..], ...} | optional, arrayForm, json | Array of details in the charge (see content structure) |
*
Campos requeridos
1.4.1. Route details
Route for sending parameters:
https://pixelpay.app/api/v2/generate POST
This route is ideal for generating payments unattended through third-party software or developing a module for an existing application.
Charges can even be generated with additional
parameters that will be returned in the extra field in the Success URL and Error URL webhooks.
Two types of charges can be generated, the single payment where only a value is specified in amount
and the charge with details in which it can be detailed in the content
field in an arrangement, item by item with its respective tax.
The generated result is injson
format, if the result fails, it returns a message
field in which it indicates what the error is, if the payment is successfully generated the response results in:
Example • Successful response
{
"success": true,
"url": "https://www.pixelpay.app/.../checkout"
}
Example • Error response
{
"success": false,
"errors" : {
"name": [
"El campo name es obligatorio."
],
...
}
}
The success
field will indicate the status of the result, and the url
field will return the generated URL in which it can be used to be sent by other means or shared.
Comments
0 comments
Please sign in to leave a comment.