Models (defined as models
within the SDK) provide predefined classes to facilitate interaction with PixelPay entities such as credit cards, orders, billing, delivery addresses, etc.
These include all the necessary definitions to cover most types of integration with PixelPay.
Within the models we can find:
Settings
: SDK settings.Environment
: values of different types of environments.Billing
: billing information.Card
: credit/debit cards.Item
: all kinds of items for sale.Order
: order data.Models are necessary, since they are the components that make up requests.
Settings
contains all the properties needed to set up the SDK, such as saving merchant keys and the PixelPay endpoint.
Settings
propertiesProperty | Type | Access | Default |
---|---|---|---|
auth_key |
string |
public |
API authentication key ( key ID
).
Property | Type | Access | Default |
---|---|---|---|
auth_hash |
string |
public |
Merchant API Authentication MD5 Hash.
When setting the auth_hash
, this must be exactly the MD5 hash of the secret key.
For example, if your merchant's secret key is c0c485c0-4515-11ec-81d3-0242
,
the authentication hash should be 79ac9a7ba7ced61faf750faa10e92037
.
Do not share the secret code of your business with anyone.
Property | Type | Access | Default |
---|---|---|---|
auth_user |
string |
public |
SHA-512 hash of the merchant's authenticated user's email.
When setting the auth_user
, this must be exactly the SHA-512 hash of the user's email.
For example, if your merchant user's email is johndoe@email.test
,
the hash must start with 59f9ec68a047719a30d2e52cb79f1306184...
.
Property | Type | Access | Default |
---|---|---|---|
endpoint |
string |
public |
"https://pixelpay.app" |
Merchant API endpoint URL. You can find your merchant's endpoint by following these instructions.
Property | Type | Access | Default |
---|---|---|---|
environment |
string |
public |
Commerce API environment. The environment can have the values of: live
or sandbox
.
Property | Type | Access | Default |
---|---|---|---|
lang |
string |
public |
Language set for API responses.
Settings
methodsFunction | Parameters | Return | Access |
---|---|---|---|
setupEndpoint |
endpoint: string |
void |
public |
Set up merchant API endpoint URL.
Function | Parameters | Return | Access |
---|---|---|---|
setupCredentials |
key: string hash: string |
void |
public |
Set up merchant keys for the API. Receives the merchant's identification key ( key ID
) and the MD5 hash of the merchant's secret key ( secret key
).
Function | Parameters | Return | Access |
---|---|---|---|
setupPlatformUser |
hash: string |
void |
public |
Set up the platform user. Receives the SHA-512 hash of the email of the authenticated user of the merchant.
Function | Parameters | Return | Access |
---|---|---|---|
setupEnviroment |
env: string |
void |
public |
Set up the environment. Receivess the new environment value, can have the values of: live
, sandbox
.
Function | Parameters | Return | Access |
---|---|---|---|
setupSandbox |
void |
public |
Save the default settings for sandbox: endpoint URL, merchant keys and environment type sandbox
.
Function | Parameters | Return | Access |
---|---|---|---|
setupLanguage |
lang: String |
void |
public |
Save language settings for API responses.
Billing
is a class that describes the properties for creating billing data in PixelPay. Billing data is required at the time of generating a sale or a tokenized credit/debit card.
Billing
propertiesProperty | Type | Access | Default |
---|---|---|---|
address |
string |
public |
Customer billing address.
Property | Type | Access | Default |
---|---|---|---|
country |
string |
public |
Alpha-2 code of the customer's billing country (ISO-3166-1).
It is very important that the format described in the ISO-3166-1 standard is followed. You can review the location resources here).
Property | Type | Access | Default |
---|---|---|---|
state |
string |
public |
Alpha code of the customer's billing status (ISO-3166-2).
It is very important that the format described in the ISO-3166-1 standard is followed. You can review the location resources here).
Property | Type | Access | Default |
---|---|---|---|
city |
string |
public |
Customer billing city.
Property | Type | Access | Default |
---|---|---|---|
zip |
string |
public |
Customer's billing postal code.
Property | Type | Access | Default |
---|---|---|---|
phone |
string |
public |
Customer billing phone.
Card
is the class that describes the properties for creating a credit/debit card in PixelPay.
Card
propertiesProperty | Type | Access | Default |
---|---|---|---|
number |
string |
public |
Card number or PAN.
Property | Type | Access | Default |
---|---|---|---|
cvv2 |
string |
public |
Card Security Code.
Property | Type | Access | Default |
---|---|---|---|
expire_month |
number |
public |
Card expiration month date (MM).
Property | Type | Access | Default |
---|---|---|---|
expire_year |
number |
public |
Card expiration date (YYYY).
It is very important that the format described above (YYYY) is followed, for example: 2022
, 2023
, 2024
, etc.
Property | Type | Access | Default |
---|---|---|---|
cardholder |
string |
public |
Cardholder Name.
Card
methodsFunction | Parameters | Return | Access |
---|---|---|---|
getExpireFormat |
string |
public |
Get card expiration ISO format (YYMM).
Item
is a class that describes the properties for creating an item for sale.
Item
Property | Type | Access | Default |
---|---|---|---|
code |
string |
public |
Item identifier code or UPC / EAN.
Property | Type | Access | Default |
---|---|---|---|
title |
string |
public |
Product title of the article.
Property | Type | Access | Default |
---|---|---|---|
price |
number |
public |
Item for unit price.
Property | Type | Access | Default |
---|---|---|---|
qty |
number |
public |
Quantity of items.
Property | Type | Access | Default |
---|---|---|---|
tax |
number |
public |
Amount of tax on the item per unit.
Property | Type | Access | Default |
---|---|---|---|
total |
number |
public |
Full value of the item.
Item
Function | Parameters | Return | Access |
---|---|---|---|
totalize |
Item |
public |
Total price of the item by quantity. Whenever the price or quantity of the item changes, we can then calculate the new total with this method.
Order
is a class that has everything you need to create an order in PixelPay.
Order
propertiesProperty | Type | Access | Default |
---|---|---|---|
id |
string |
public |
Order ID.
Property | Type | Access | Default |
---|---|---|---|
currency |
string |
public |
Order currency code in alpha-3.
You can review the ISO 4217
standard to see the different currency codes available.
Please note that you will only be able to use the currency codes available in PixelPay.
Property | Type | Access | Default |
---|---|---|---|
amount |
number |
public |
Total amount of the order.
Property | Type | Access | Default |
---|---|---|---|
tax_amount |
number |
public |
Total tax amount of the order.
Property | Type | Access | Default |
---|---|---|---|
shipping_amount |
number |
public |
Total amount of the order shipment.
Property | Type | Access | Default |
---|---|---|---|
content |
List<Item> |
public |
Summary of orders of articles or products.
Property | Type | Access | Default |
---|---|---|---|
extras |
object |
public |
Additional properties related to the order.
Property | Type | Access | Default |
---|---|---|---|
note |
string |
public |
Order note or additional instructions.
Property | Type | Access | Default |
---|---|---|---|
callback_url |
string |
public |
Order callback webhook URL.
The callback_url
is a webbook that is activated when the transaction has been successfully paid, and it must be able to travel to an active server.
It is not allowed to use a callback_url
that is not connected to a public domain (i.e localhost
is not allowed ).
Property | Type | Access | Default |
---|---|---|---|
customer_name |
string |
public |
Name of the client of the order.
Property | Type | Access | Default |
---|---|---|---|
customer_email |
string |
public |
Customer email.
Order
methodsFunction | Parameters | Return | Access |
---|---|---|---|
addItem |
item: Item |
Order |
public |
Add item to product/item content list.
Function | Parameters | Return | Access |
---|---|---|---|
addExtra |
key: string value: any |
Order |
public |
Allows you to add additional properties to the order.
The additional parameters will be reflected in the sending of webhook data, and can be used for own or custom developments.
Function | Parameters | Return | Access |
---|---|---|---|
totalize |
Order |
public |
Calculate the order total based on all the items that have been added. Whenever the price or quantity of an item changes we can then calculate the new total with this method.