### Construct Servipag Redirection URL (URL)
Source: https://docs.paylands.com/docs/apm/apm-servipag
This example demonstrates how to construct the URL for redirecting a user to the Servipag payment screen. It requires replacing '{token}' with the actual payment order token and appending '?apm=SERVIPAG' to specify the payment method.
```url
https://api.paylands.com/v1/sandbox/payment/process/{token}?apm=SERVIPAG
```
--------------------------------
### Examples of 'extra_data' for Transfer Payouts
Source: https://docs.paylands.com/docs/integrations/payment-service-payretailers
Provides example structures for the `extra_data` object when initiating payouts using the Transfer method.
```APIDOC
## Examples of `extra_data` for Transfer Payouts
### Example for Brazil (Transfer)
```json
{
"profile": {
"first_name": "Joao",
"last_name": "Silva",
"email": "joao.silva@email.com",
"document_identification_number": "12345678901",
"phone": {
"number": "+5511987654321"
}
},
"billing_address": {
"address1": "Rua Exemplo, 123",
"country": "BRA"
},
"payment": {
"bank_name": "001",
"account": "123456789",
"account_type": "CHECKING",
"account_agency_number": "1234",
"aba_swift": "ABCBRSPX"
}
}
```
### Example for Colombia (Transfer)
```json
{
"profile": {
"first_name": "Maria",
"last_name": "Gomez",
"email": "maria.gomez@email.com",
"document_identification_number": "1012345678",
"document_identification_type": "NATIONAL_IDENTITY_DOCUMENT",
"phone": {
"number": "+573101234567"
}
},
"billing_address": {
"address1": "Carrera 10 # 20-30",
"country": "COL"
},
"payment": {
"bank_name": "BANCOLOMBIA",
"account": "123456789012",
"account_type": "CHECKING"
}
}
```
### Example for Peru (Transfer)
```json
{
"profile": {
"first_name": "Carlos",
"last_name": "Perez",
"email": "carlos.perez@email.com",
"document_identification_number": "12345678",
"document_identification_type": "NATIONAL_IDENTITY_DOCUMENT",
"phone": {
"number": "+51987654321"
}
},
"billing_address": {
"address1": "Av. Principal 456",
"country": "PER"
},
"payment": {
"bank_name": "BCP",
"account": "1234567890123",
"account_type": "CHECKING"
}
}
```
```
--------------------------------
### XML Namespaces: Declared Prefixes Example
Source: https://docs.paylands.com/docs/proxy-pci/channels
This example demonstrates XML with declared namespaces using prefixes. Understanding how prefixes map to URIs is essential for correctly querying XML data using XPath.
```xml
Lord of the Rings
J.R.R. Tolkien
```
--------------------------------
### Example of 'extra_data' for PIX Payouts
Source: https://docs.paylands.com/docs/integrations/payment-service-payretailers
Provides an example structure for the `extra_data` object when initiating payouts using the PIX method in Brazil.
```APIDOC
## Example of `extra_data` for PIX Payouts
### Example for Brazil (PIX)
```json
{
"profile": {
"first_name": "Maria",
"last_name": "Oliveira",
"email": "maria.oliveira@email.com",
"document_identification_number": "11122233344",
"phone": {
"number": "+5511999998888"
}
},
"billing_address": {
"address1": "Avenida Brasil, 500",
"country": "BRA"
},
"payment": {
"recipient_pix_key": "11122233344"
}
}
```
### Example for Brazil (PIX - using CPF as default)
```json
{
"profile": {
"first_name": "Jose",
"last_name": "Santos",
"email": "jose.santos@email.com",
"document_identification_number": "99988877766",
"phone": {
"number": "+5521987651234"
}
},
"billing_address": {
"address1": "Rua Sao Paulo, 700",
"country": "BRA"
}
// 'payment.recipient_pix_key' is omitted, so 'document_identification_number' (99988877766) will be used as the PIX key.
}
```
```
--------------------------------
### Construct Khipu Payment Redirection URL
Source: https://docs.paylands.com/docs/apm/apm-khipu
This example shows how to construct the redirection URL for processing a Khipu payment. The '{token}' placeholder should be replaced with the token received from the payment order generation.
```url
https://api.paylands.com/v1/sandbox/payment/process/{token}?apm=KHIPU
```
--------------------------------
### GET /subscriptions/products
Source: https://docs.paylands.com/reference
Lists all products created to date.
```APIDOC
## GET /subscriptions/products
### Description
Lists all products created to date.
### Method
GET
### Endpoint
- Sandbox: `https://api.paylands.com/v1/sandbox/subscriptions/products`
- Production: `https://api.paylands.com/v1/subscriptions/products`
### Parameters
#### Header Parameters
- **Authorization** (string) - Required - `Basic RXN0YUVzVHVBUElLZXlNYW50ZW5sYVNlZ3VyYQ==` - Authorization header with your API Key.
### Response
#### Success Response (200)
- **message** (string) - "OK"
- **code** (integer) - 200
- **current_time** (string) - Current timestamp
- **products** (array) - List of product objects.
```
--------------------------------
### XML Example: Hotel Reservation Notification
Source: https://docs.paylands.com/docs/proxy-pci/channels
This is an example of an XML payload representing a hotel reservation notification, potentially extracted from the Siteminder channel manager. It includes details like reservation status, unique identifiers, and payment card information.
```xml
::someUsername
::somePassword::
John Doe
```
--------------------------------
### Render Alternative Payment Method (Bizum Example)
Source: https://docs.paylands.com/docs/checkout/checkout-sdk-integration
This snippet shows how to call the specific payment method function, in this case 'bizum', to render the payment form within a designated HTML container. It also includes examples of form and customization configurations.
```APIDOC
## POST /websites/paylands/renderPaymentMethod
### Description
Renders an alternative payment method within a specified container.
### Method
POST (simulated via function call)
### Endpoint
N/A (This is a client-side SDK function call)
### Parameters
#### Path Parameters
None
#### Query Parameters
None
#### Request Body
This is represented by the function arguments:
- **paymentMethod** (string) - Required - The name of the payment method to render (e.g., 'bizum', 'boleto').
- **container** (string) - Required - The ID of the HTML element where the payment form will be rendered.
- **form** (Object) - Required - Configuration for the payment form fields.
- **nameLabel** (string) - Optional - Label for the name input.
- **nameError** (string) - Optional - Error message for the name input.
- **lastNameLabel** (string) - Optional - Label for the last name input.
- **lastNameError** (string) - Optional - Error message for the last name input.
- **emailLabel** (string) - Optional - Label for the email input.
- **emailError** (string) - Optional - Error message for the email input.
- **prefixLabel** (string) - Optional - Label for the phone prefix input.
- **prefixError** (string) - Optional - Error message for the phone prefix input.
- **phoneLabel** (string) - Optional - Label for the phone number input.
- **phoneError** (string) - Optional - Error message for the phone number input.
- **documentIdentificationNumberLabel** (string) - Optional - Label for the personal identification number input.
- **documentIdentificationNumberError** (string) - Optional - Error message for the personal identification number input.
- **birthdateLabel** (string) - Optional - Label for the birthdate input.
- **birthdateError** (string) - Optional - Error message for the birthdate input.
- **addressLabel** (string) - Optional - Label for the address input.
- **addressError** (string) - Optional - Error message for the address input.
- **zipCodeLabel** (string) - Optional - Label for the zip code input.
- **zipCodeError** (string) - Optional - Error message for the zip code input.
- **cityLabel** (string) - Optional - Label for the city input.
- **cityError** (string) - Optional - Error message for the city input.
- **countryLabel** (string) - Optional - Label for the country input.
- **countryError** (string) - Optional - Error message for the country input.
- **prefilledName** (string) - Optional - Pre-filled user name.
- **prefilledLastName** (string) - Optional - Pre-filled user last name.
- **prefilledEmail** (string) - Optional - Pre-filled user email.
- **prefilledPrefix** (string) - Optional - Pre-filled user phone prefix.
- **prefilledPhone** (string) - Optional - Pre-filled user phone number.
- **prefilledDocumentIdentificationNumber** (string) - Optional - Pre-filled personal identification number.
- **prefilledBirthdate** (string) - Optional - Pre-filled user birthdate.
- **prefilledAddress** (string) - Optional - Pre-filled user address.
- **prefilledZipCode** (string) - Optional - Pre-filled user zip code.
- **prefilledCity** (string) - Optional - Pre-filled user city.
- **prefilledCountry** (string) - Optional - Pre-filled user country.
- **customization** (Object) - Optional - Styling and appearance customization for the payment form.
- **font** (string) - Optional - Text font.
- **primaryColor** (string) - Optional - Button color.
- **textColor** (string) - Optional - Text color.
- **backgroundColor** (string) - Optional - Background color.
- **errorColor** (string) - Optional - Error text color.
- **borderColor** (string) - Optional - Input border color.
- **borderRadius** (string) - Optional - Input border radius.
- **padding** (string) - Optional - Spacing.
- **inputTextSize** (string) - Optional - Input text size.
- **labelTextSize** (string) - Optional - Label text size.
- **iconSize** (string) - Optional - Icon size.
- **iconColor** (string) - Optional - Icon color.
- **buttonText** (string) - Optional - Text for the submit button. Required if the SDK should display the submit button.
- **buttonTextSize** (string) - Optional - Text size for the submit button.
### Request Example
```javascript
await paylandsCheckout.bizum({
container: 'renderContainer',
form: {
nameLabel: 'Your Name',
prefilledName: 'John Doe'
},
customization: {
primaryColor: '#007bff',
buttonText: 'Pay Now'
}
});
```
### Response
#### Success Response (200)
This function call does not return a direct response body. Success is indicated by the form rendering correctly and subsequent event listeners.
#### Response Example
N/A
```
--------------------------------
### GET /subscriptions/plans
Source: https://docs.paylands.com/reference
Lists all created subscription plans. Requires an Authorization header.
```APIDOC
## Listar planes
### Description
Lists all subscription plans created to date.
### Method
GET
### Endpoint
https://api.paylands.com/v1/subscriptions/plans
(Sandbox: https://api.paylands.com/v1/sandbox/subscriptions/plans)
### Parameters
#### Header Parameters
- **Authorization** (string) - Required - Authentication header. Example: Basic RXN0YUVzVHVBUElLZXlNYW50ZW5sYVNlZ3VyYQ==
### Response
#### Success Response (200)
- **message** (string) - OK message.
- **code** (number) - Response status code.
- **current_time** (string) - Timestamp of the current time.
- **plans** (array) - An array of subscription plan objects.
- Each plan object contains details like amount, creation time, external ID, intervals, name, trial availability, and associated product details.
#### Response Example
```json
{
"message": "OK",
"code": 200,
"current_time": "2019-12-04T16:55:28+0100",
"plans": [
{
"amount": 499,
"created_at": "2019-12-04 16:30:29",
"external_id": "plan",
"interval": 1,
"interval_offset": 1,
"interval_offset_type": "WEEKLY",
"interval_type": "DAILY",
"name": "Real plan name",
"trial_available": true,
"updated_at": "2019-12-04 16:30:29",
"product": {
"created_at": "2019-12-04 15:29:10",
"external_id": "product",
"name": "Real product",
"notification_url": "https://yourdomain.com/subscriptions/notify",
"sandbox": false,
"updated_at": "2019-12-04 15:29:10"
}
}
]
}
```
```
--------------------------------
### Mostrar el formulario de tokenización con el SDK de Paylands
Source: https://docs.paylands.com/docs/guides/sdk-tokenization
Código Javascript para inicializar el formulario de tokenización de Paylands. Escucha el evento 'paylandsLoaded' para asegurarse de que el SDK está listo, configura el modo (sandbox/producción) y llama a 'paylands.initializate()' con el token del cliente y el ID del contenedor del formulario.
```javascript
```
--------------------------------
### Cybersource - Error code structure
Source: https://docs.paylands.com/docs/integrations/payment-service-cybersource
This example illustrates the standard format for Cybersource error codes, which consists of a 'Status' followed by a 'Reason'.
```text
Status - Reason
```
--------------------------------
### POST /v1/sandbox/subscriptions/subscription
Source: https://docs.paylands.com/docs/guides/guide-subscriptions
Subscribes a client to a specified plan. This endpoint handles the creation of a subscription and can initiate an immediate charge if the plan does not have a trial period available.
```APIDOC
## POST /v1/sandbox/subscriptions/subscription
### Description
Subscribes a client to a specified plan. If the plan has `trial_available` set to false, an immediate charge will occur.
### Method
POST
### Endpoint
`https://api.paylands.com/v1/sandbox/subscriptions/subscription`
### Parameters
#### Request Body
- **signature** (string) - Required - Signature for the request.
- **customer** (string) - Required - External ID of the customer to subscribe.
- **plan** (string) - Required - External ID of the plan to subscribe to.
- **additional_data** (object) - Optional - Block of data with additional subscription information.
- **additional** (string) - Optional - Free field for custom data.
- **customer_ext_id** (string) - Required - External ID of the customer. Must match the `customer` field.
- **operative** (string) - Required - Type of operation, typically `AUTHORIZATION`.
- **service** (string) - Required - UUID of the service.
- **source_uuid** (string) - Required - UUID of the saved card.
- **url_post** (string) - Required - Your server's URL for Paylands notifications.
- **initial_date** (string) - Optional - The start date for the subscription (ISO 8601 format).
- **payment_attempts_limit** (integer) - Optional - Maximum number of payment attempts allowed.
- **total_payment_number** (integer) - Optional - Maximum number of successful payments before the subscription is cancelled. Leave empty for no expiration.
### Request Example
```json
{
"signature": "121149a0ba5361191d740fa898784a8b",
"customer": "ES41749999P",
"plan": "MENSUAL",
"additional_data": {
"additional": "Datos extra",
"customer_ext_id": "ES41749999P",
"operative": "AUTHORIZATION",
"service": "60A1F4C0-CC58-47A9-A0B9-868F9EF29045",
"source_uuid": "C10721E7-1404-45DC-8762-351DD9945D1D",
"url_post": "https://yourdomain.com/subscriptions/notify"
},
"initial_date": "2022-02-05T10:34:12.640Z",
"payment_attempts_limit": 3,
"total_payment_number": null
}
```
### Response
#### Success Response (200)
- **amount** (integer) - The amount of the payment.
- **attempt** (integer) - The current payment attempt number.
- **company** (string) - The company ID.
- **currency** (string) - The currency code.
- **customer** (string) - The external customer ID.
- **payment_date** (string) - The date and time of the payment.
- **payment_id** (string) - The ID of the payment.
- **payment_number** (integer) - The number of the current payment in the subscription cycle.
- **plan** (string) - The external plan ID.
- **product** (string) - The product ID.
- **status** (string) - The status of the subscription (`PAID`, `FAILED_NOTIFICATION`, etc.).
- **subscription** (string) - The ID of the subscription.
#### Response Example
```json
{
"amount": 1,
"attempt": 1,
"company": "FF255421-F4B7-47E9-9816-949F5F03DE6F",
"currency": "978",
"customer": "customer_external_id",
"payment_date": "2022-02-05T10:34:12.640Z",
"payment_id": "5dfa00a4229c1a127749ae9e",
"payment_number": 1,
"plan": "plan_external_id",
"product": "product_external_id",
"status": "PAID",
"subscription": "5dfa00a4229c1a127749ae9d"
}
```
#### Error Handling
If parameters like service UUID or card UUID are incorrect, the subscription will be registered, but the payment will fail, resulting in a `FAILED_NOTIFICATION` status.
```
--------------------------------
### POST /v1/sandbox/payment/process/{token}?apm=KHIPU (Flow Integration)
Source: https://docs.paylands.com/docs/apm/apm-khipu
Initiates a Khipu payment via Flow using redirection. Requires user presence and browser processing. Generates a payment order and redirects the user to the payment screen.
```APIDOC
## POST /v1/sandbox/payment/process/{token}?apm=KHIPU
### Description
Initiates a Khipu payment via Flow using redirection. The user must be present, and the payment processed through a browser. A payment order is generated first, then the user is redirected to the payment screen.
### Method
POST
### Endpoint
`https://api.paylands.com/v1/sandbox/payment/process/{token}?apm=KHIPU`
### Parameters
#### Path Parameters
- **token** (string) - Required - The token of the order generated.
#### Query Parameters
- **apm** (string) - Required - Must be set to `KHIPU`.
#### Request Body
- **extra_data** (object) - Optional - Contains additional data for the payment.
- **profile** (object) - Required within `extra_data` for Flow.
- **email** (string) - Required - The email of the user making the payment.
### Request Example
```json
{
"extra_data": {
"profile": {
"first_name": " ",
"last_name": " ",
"email": "test@gmail.com"
}
}
}
```
### Response
#### Success Response (302 Found)
- **Location** (string) - The URL to redirect the user to for payment processing.
#### Response Example
*The response is a redirect to the payment gateway.*
```
--------------------------------
### SPEI Payment Redirection URL Construction
Source: https://docs.paylands.com/docs/apm/apm-spei
This example demonstrates how to construct the redirection URL for processing a SPEI payment. The URL includes the payment order token and specifies 'SPEI' as the APM (Alternative Payment Method).
```url
https://api.paylands.com/v1/sandbox/payment/process/{token}?apm=SPEI
```
--------------------------------
### Paylands SDK Initialization
Source: https://docs.paylands.com/docs/guides/sdk-tokenization
This snippet demonstrates how to initialize the Paylands SDK and display the tokenization form after the library has loaded and a customer token has been obtained.
```APIDOC
## Paylands SDK Initialization and Form Display
### Description
Initializes the Paylands SDK and renders the card tokenization form within a specified HTML element. This process should be triggered after the `paylandsLoaded` event.
### Method
JavaScript
### Endpoint
N/A (Client-side SDK interaction)
### Parameters
N/A (Configuration within JavaScript)
### Request Example
```javascript
window.addEventListener('message', receiveMessage => {
if (receiveMessage.data === 'paylandsLoaded') {
// Listen for the paylandsLoaded message to proceed
console.log('PaylandsLoaded', paylands);
// If testing, change the mode to sandbox. Remove this line in production.
paylands.setMode('sandbox');
// Initialize the form with the customer token and the target div ID
paylands.initializate(
'CUSTOMER_TOKEN', // Replace with the actual customer token obtained from POST /v1/customer
'paylands-iframe' // The ID of the div where the form will be rendered
);
}
}, false);
// Optional: Set a custom template for the form
paylands.setTemplate(
'C082AA84-EC2D-4ED2-9312-D0992832E490' // UUID of the created template
);
```
### Notes
- The `paylandsLoaded` event must be listened for to ensure the SDK is ready.
- Replace `'CUSTOMER_TOKEN'` with the actual token received from the `POST /v1/customer` endpoint.
- The `paylands-iframe` ID corresponds to the HTML `div` element where the form will be embedded (e.g., ``).
- `paylands.setMode('sandbox');` is for testing purposes and should be removed in production.
- `paylands.setTemplate('TEMPLATE_UUID');` is optional. If not used, the default form template will be loaded.
```
--------------------------------
### Subscription Success Response Example
Source: https://docs.paylands.com/docs/guides/guide-subscriptions
This JSON object represents a successful subscription response from the Paylands API. It includes details about the payment, such as amount, currency, customer and plan identifiers, payment date, and the final status of the subscription.
```json
{
"amount": 1,
"attempt": 1,
"company": "FF255421-F4B7-47E9-9816-949F5F03DE6F",
"currency": "978",
"customer": "customer_external_id",
"payment_date": "2022-02-05T10:34:12.640Z",
"payment_id": "5dfa00a4229c1a127749ae9e",
"payment_number": 1,
"plan": "plan_external_id",
"product": "product_external_id",
"status": "PAID",
"subscription": "5dfa00a4229c1a127749ae9d"
}
```
--------------------------------
### POST /v1/sandbox/payment/process/{token}?apm=KHIPU (Payretailers Integration)
Source: https://docs.paylands.com/docs/apm/apm-khipu
Initiates a Khipu payment via Payretailers using redirection. Requires user presence and browser processing. Generates a payment order with detailed user and billing information, then redirects the user.
```APIDOC
## POST /v1/sandbox/payment/process/{token}?apm=KHIPU
### Description
Initiates a Khipu payment via Payretailers using redirection. The user must be present, and the payment processed through a browser. A payment order is generated with detailed user and billing information, then the user is redirected to the payment screen.
### Method
POST
### Endpoint
`https://api.paylands.com/v1/sandbox/payment/process/{token}?apm=KHIPU`
### Parameters
#### Path Parameters
- **token** (string) - Required - The token of the order generated.
#### Query Parameters
- **apm** (string) - Required - Must be set to `KHIPU`.
#### Request Body
- **extra_data** (object) - Optional - Contains additional data for the payment.
- **checkout** (object) - Required within `extra_data` for Payretailers.
- **uuid** (string) - Required - Checkout UUID.
- **profile** (object) - Required within `extra_data` for Payretailers.
- **first_name** (string) - Required - The first name of the user.
- **last_name** (string) - Required - The last name of the user.
- **email** (string) - Required - The email of the user.
- **document_identification_number** (string) - Required - The user's identification number.
- **phone** (object) - Required - Phone number details.
- **number** (string) - Required - The phone number.
- **prefix** (string) - Required - The phone number prefix (e.g., country code).
- **billing_address** (object) - Required within `extra_data` for Payretailers.
- **city** (string) - Required - The billing city.
- **country** (string) - Required - The billing country code (e.g., COL).
- **address1** (string) - Required - The billing address line 1.
- **zip_code** (string) - Required - The billing zip code.
- **state_code** (string) - Required - The billing state code.
### Request Example
```json
{
"extra_data": {
"checkout": {
"uuid": "C42043F9-B77C-4918-BD43-86C526B4F24D"
},
"profile": {
"first_name": "Kobe",
"last_name": "Bryant",
"email": "andreu.sanchez@paynopain.com",
"document_identification_number": "92309089",
"phone": {
"number": "02614235138",
"prefix": "54"
}
},
"billing_address": {
"city": "Castellon",
"country": "COL",
"address1": "Avinguda del Mar 23",
"zip_code": "12000",
"state_code": "CT"
}
}
}
```
### Response
#### Success Response (302 Found)
- **Location** (string) - The URL to redirect the user to for payment processing.
#### Response Example
*The response is a redirect to the payment gateway.*
```
--------------------------------
### Get Card Payment Response Example - JSON
Source: https://docs.paylands.com/reference
This JSON structure represents a successful response when retrieving card payment information. It includes details about the transaction, such as message, status code, current time, and a list of associated cards with their properties like bank, brand, country, and token.
```json
{
"message": "OK",
"code": 200,
"current_time": "2017-01-12T09:12:58+0100",
"cards": [
{
"additional": null,
"bank": "SERVIRED, SOCIEDAD ESPANOLA DE MEDIOS DE PAGO, S.A.",
"bin": 454881,
"brand": "VISA",
"country": "724",
"creation_date": "2020-02-18 17:22:56",
"expire_month": "12",
"expire_year": "21",
"holder": "Test user",
"is_saved": true,
"last4": "0004",
"object": "CARD",
"token": "ebc9b5ffa2efcf74197734a071192817e6f2a3fc15f49c4b1bdb6edc46b16e3ab4109498bff8e6ba00fb6d2bd1838afbea67095c4caaa2f46e4acf4d5851884c",
"type": "CREDIT",
"uuid": "90F358C9-7D3F-4334-A60D-1717CC1FBF5B"
},
{
"additional": null,
"bank": "SERVIRED, SOCIEDAD ESPANOLA DE MEDIOS DE PAGO, S.A.",
"bin": 533821,
"brand": "MASTERCARD",
"country": "724",
"creation_date": "2020-02-18 17:22:56",
"expire_month": "04",
"expire_year": "23",
"holder": "Test user",
"is_saved": true,
"last4": "0004",
"object": "CARD",
"token": "ad49b5b1a2efcf74197734a071192817e6f2a3fc15f49c4b1bdb6edc46b16e3ab4109498bff8e6ba00fb6d2bd1838afbea67095c4caaa2f46e4acf4d58516cba",
"type": "CREDIT",
"uuid": "0FDE261B-0E76-499D-A394-B6DCF6C03C56"
}
]
}
```
--------------------------------
### Cargar la librería SDK de Paylands
Source: https://docs.paylands.com/docs/guides/sdk-tokenization
Instrucciones para incluir la librería Javascript del SDK de tokenización de Paylands en tu web o aplicación. Una vez cargada, la variable global 'paylands' estará disponible para interactuar con el SDK.
```html
```
--------------------------------
### Construct Boleto Redirection URL
Source: https://docs.paylands.com/docs/apm/apm-boleto
This example demonstrates how to construct the URL for redirecting a user to the Boleto payment screen. It involves appending the payment method identifier ('BOLETO') and the order token to the base API endpoint. This URL is used to initiate the payment process via a browser.
```bash
https://api.paylands.com/v1/sandbox/payment/process/{token}?apm=BOLETO
```
--------------------------------
### POST /v1/sandbox/client
Source: https://docs.paylands.com/reference
Creates a new merchant account in the sandbox environment.
```APIDOC
## POST /v1/sandbox/client
### Description
Creates a new merchant account in the sandbox environment. This endpoint is exclusive to the Sandbox environment.
### Method
POST
### Endpoint
https://api.paylands.com/v1/sandbox/client
### Parameters
#### Request Body
- **signature** (string) - Required - Signature accompanying the API key. Required for all POST/PUT/DELETE requests.
- **name** (string) - Required - Merchant's name.
- **email** (string) - Required - Merchant's email.
- **timezone** (string) - Required - Merchant's timezone.
- **autorecover_transactions** (boolean) - Optional - Automatically recover pending transactions.
- **resend_failed_notifications** (boolean) - Optional - Set to true to resend requests to the merchant that did not return a 200 to Paylands.
- **category** (string) - Optional - Merchant category. Enum values include 'ACCOUNTING_SERVICES', 'ADULT', 'ALCOHOL', etc.
- **mcc** (string) - Optional - Merchant category code, must contain four numbers.
- **parent_uuid** (string) - Optional - Indicates the parent of the merchant if creation under a different client than the requester is desired.
### Request Example
```json
{
"signature": "121149a0ba5361191d740fa898784a8b",
"name": "Client Name",
"email": "email@email.com",
"timezone": "Europe/Madrid",
"autorecover_trasactions": false,
"resend_failed_notifications": false,
"category": "HOTELS",
"mcc": "5732",
"parent_uuid": "8dc780e8-c311-4791-a47f-c1a272ffbb87"
}
```
### Response
#### Success Response (200)
- **message** (string) - OK
- **code** (integer) - HTTP status code.
- **current_time** (string) - Current server time.
- **client** (object) - Details of the created client.
- **uuid** (string) - Unique identifier for the client.
- **created** (string) - Creation timestamp.
- **name** (string) - Merchant's name.
- **email** (string) - Merchant's email.
- **timezone** (string) - Merchant's timezone.
- **autorecover_transactions** (boolean) - Recovery status.
- **resend_failed_notifications** (boolean) - Resend status.
- **is_pci** (boolean) - PCI compliance status.
- **is_deleted** (boolean) - Deletion status.
- **category** (string) - Merchant category.
- **mcc** (string) - Merchant category code.
- **address** (string|null) - Merchant address.
- **phone_number** (string|null) - Merchant phone number.
- **api_key** (string) - Merchant API key.
- **signature** (string) - Merchant signature.
- **services** (object|null) - Associated services.
#### Response Example (200)
```json
{
"message": "OK",
"code": 200,
"current_time": "2017-01-12T09:12:58+0100",
"client": {
"uuid": "962C3723-A0BC-4911-8F0F-0CCE963C5218",
"created": "2024-05-08T10:21:09+0200",
"name": "Client Name",
"email": "email@email.com",
"timezone": "Europe\Madrid",
"autorecover_transactions": false,
"resend_failed_notifications": false,
"is_pci": false,
"is_deleted": false,
"category": "HOTELS",
"mcc": "5732",
"address": null,
"phone_number": null,
"api_key": "1d5f130ad27245c2b66ce5a90f0d3a87",
"signature": "7OyXl3zup9gijNRrhuUKX3ub",
"services": null
}
}
```
#### Error Responses
- **403** Forbidden
- **404** Not Found
```
--------------------------------
### Create Product - Paylands API
Source: https://docs.paylands.com/reference
Registers a product that identifies the service being offered, potentially with multiple associated plans. The request body requires a signature, product name, and external ID. An optional notification URL can be provided to receive payment status updates. Sandbox products do not involve real money transactions.
```json
{
"signature": "121149a0ba5361191d740fa898784a8b",
"external_id": "product",
"name": "Real product",
"notification_url": "https://yourdomain.com/subscriptions/notify"
}
```
```json
{
"message": "OK",
"code": 200,
"current_time": "2019-12-04T15:29:10+0100",
"product": {
"created_at": "2019-12-04 15:29:10",
"external_id": "product",
"name": "Real product",
"notification_url": "https://yourdomain.com/subscriptions/notify",
"sandbox": false,
"updated_at": "2019-12-04 15:29:10"
}
}
```
--------------------------------
### POST /subscriptions/product
Source: https://docs.paylands.com/reference
Creates a product to identify the service being offered. Products can have multiple plans with different pricing.
```APIDOC
## POST /subscriptions/product
### Description
Creates a product to identify the service being offered. Products can have multiple plans with different pricing. Sandbox products do not involve real money transactions.
### Method
POST
### Endpoint
- Sandbox: `https://api.paylands.com/v1/sandbox/subscriptions/product`
- Production: `https://api.paylands.com/v1/subscriptions/product`
### Parameters
#### Header Parameters
- **Authorization** (string) - Required - `Basic RXN0YUVzVHVBUElLZXlNYW50ZW5sYVNlZ3VyYQ==` - Authorization header with your API Key.
#### Request Body
- **signature** (string) - Required - Signature accompanying the API key. Required for all POST/PUT/DELETE requests.
- **external_id** (string) - Required - Unique external ID assigned by the merchant to identify the product.
- **name** (string) - Required - Name of the product.
- **notification_url** (string) - Optional - URL to receive HTTP notifications when the payment status changes.
### Request Example
```json
{
"signature": "121149a0ba5361191d740fa898784a8b",
"external_id": "product",
"name": "Real product",
"notification_url": "https://yourdomain.com/subscriptions/notify"
}
```
### Response
#### Success Response (200)
- **message** (string) - "OK"
- **code** (integer) - 200
- **current_time** (string) - Current timestamp
- **product** (object) - Product details:
- **created_at** (string) - Timestamp of creation
- **external_id** (string) - Unique external ID for the product
- **name** (string) - Name of the product
- **notification_url** (string) - Notification URL
- **sandbox** (boolean) - Indicates if the product is in sandbox mode
- **updated_at** (string) - Timestamp of last update
### Response Example
```json
{
"message": "OK",
"code": 200,
"current_time": "2019-12-04T15:29:10+0100",
"product": {
"created_at": "2019-12-04 15:29:10",
"external_id": "product",
"name": "Real product",
"notification_url": "https://yourdomain.com/subscriptions/notify",
"sandbox": false,
"updated_at": "2019-12-04 15:29:10"
}
}
```
```
--------------------------------
### Hash Calculation Example
Source: https://docs.paylands.com/docs/notification-validation
Example PHP code to calculate the validation hash using the received notification data and your secret signature.
```APIDOC
## Hash Calculation
### Description
This section provides a PHP code example demonstrating how to calculate the validation hash from the received notification JSON. It involves extracting specific fields, encoding them, and applying SHA256 with your secret signature.
### Method
Server-side calculation
### Endpoint
N/A
### Parameters
#### Path Parameters
None
#### Query Parameters
None
#### Request Body
(N/A - This is a code example for processing a response)
### Request Example
(N/A)
### Response
#### Success Response (200)
(N/A - This is a code example)
#### Response Example
```php
order;
$array['client'] = $jsonObject->client;
// Include 'extra_data' only if it exists in the received JSON
if (isset($jsonObject->extra_data)) {
$array['extra_data'] = $jsonObject->extra_data;
}
$data = json_encode($array, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
// Replace with your actual secret signature
$signature = 'YOUR_SECRET_SIGNATURE';
$validationHash = hash('sha256', $data . $signature);
// Compare $validationHash with $jsonObject->validation_hash
if ($validationHash === $jsonObject->validation_hash) {
echo "Notification is valid!";
} else {
echo "Notification is invalid!";
}
?>
```
```