### Authorization header example
Source: https://developers.satispay.com/reference/compose-the-authentication-header
A concrete example of a fully populated Authorization header.
```Text
Authorization: Signature keyId="4ekqhmf77q95deciis2frre12el393rteletbrg4rffqri3n58lsjsvf6uph934o7vr69r93iu4ifc3tkeidlg5fhoogo3grmh99lr2g94a6aerbf56m48og47e6vnbfu13rf1vvj3l4b3mn3qd2ttoc4a8hh2jgb589s59d56tdmp7dkuobesvfmnnpf8cmg7646do5", algorithm="rsa-sha256", headers="(request-target) host date digest", signature="C5yynRxJQG2VNdsH8yuGwgribKt1yzym8lYvTAwxFmjEf7akYgLeIGOkdZo5vE/oB7O7+kNgqHxPp9OKrs0XxGTBNNAOBPd0ELsptjuscWtF5dq/S4e8RjQvUcStJ6YOpwV/KyHwE1ovA1otrLpbxuUfqmNES65lRtYq6uuGinCJ+4mYnwrg9c6vuIJ/1b8VKi27PNpcJl4mwPg3hJ071T7Z2iolQRxDPN1ujQdKtUgudOIVLXiqQCPQKEaQQRvXkmh9fBH71fOsTPjvOP3q0XJp7tDPQF1K6MbF0RA6RehbuJ5nyBAOMWrk9r/+XrgC5zN3QmOtvrwmH2ko3du64A=="
```
--------------------------------
### Payment Creation - PENDING Example
Source: https://developers.satispay.com/reference/get-the-details-of-a-payment
An example of a successful payment creation response when the payment is in a PENDING state.
```APIDOC
## POST /api/payments (Example)
### Description
This example shows a successful response for a payment creation request, where the payment status is PENDING.
### Response Example (200 OK - PENDING)
```json
{
"id": "2ee5f6c7-f85d-45b7-8f1b-2a570a7002eb",
"code_identifier": "S6Y-PAY--2EE5F6C7-F85D-45B7-8F1B-2A570A7002EB",
"type": "TO_BUSINESS",
"amount_unit": 1240,
"currency": "EUR",
"status": "PENDING",
"expired": false,
"metadata": {
"order_id": "my_order_id",
"user_id": "my_user_id",
"payment_id": "my_payment_id",
"session_id": "my_session_id",
"key": "value"
},
"sender": {
"type": "CONSUMER"
},
"receiver": {
"id": "0c4f4511-1afa-4b17-b529-ff7465d126c1",
"type": "SHOP"
},
"insert_date": "2020-07-01T09:18:17.166Z",
"expire_date": "2020-07-01T11:18:17.163Z",
"description": "my_order_id",
"flow": "CHARGE",
"external_code": "my_order_id",
"redirect_url": "https://online.satispay.com/pay/2ee5f6c7-f85d-45b7-8f1b-2a570a7002eb?redirect_url=https%3A%2F%2Fexample.com%2Fsatispay-redirect%3Forder_id%3Dmy_order_id"
}
```
```
--------------------------------
### HTTP Request Example
Source: https://developers.satispay.com/reference/create-the-string
An example of an HTTP request including headers and a JSON body, demonstrating the context for message creation.
```http
POST /g_business/v1/payments HTTP/1.1
Host: staging.authservices.satispay.com
Date: Mon, 18 Mar 2019 15:10:24 +0000
Content-Type: application/json
Content-Length: 123
Digest: SHA-256=ZML76UQPYzw5yDTmhySnU1S8nmqGde/jhqOG5rpfVSI=
{
"flow": "MATCH_CODE",
"amount_unit": 100,
"currency": "EUR"
}
```
--------------------------------
### Payment Acceptance Example
Source: https://developers.satispay.com/reference/mv-update-payment
This example demonstrates a successful payment acceptance scenario, including details about the transaction, sender, receiver, and payment method.
```APIDOC
## POST /payments
### Description
This endpoint is used to process a new payment.
### Method
POST
### Endpoint
/payments
### Request Body
- **amount_unit** (integer) - Required - The total amount of the payment in cents.
- **currency** (string) - Required - The currency of the payment (e.g., EUR).
- **payment_method** (object) - Required - Details about the payment method used.
- **meal_voucher** (object) - Optional - Details for meal voucher payments.
- **amount_unit** (integer) - Required - The total amount of Meal Vouchers in this payment, in cents.
- **number** (integer) - Required - The total number of Meal Vouchers in this payment.
### Request Example
```json
{
"amount_unit": 1240,
"currency": "EUR",
"payment_method": {
"meal_voucher": {
"amount_unit": 800,
"number": 1
}
}
}
```
### Response
#### Success Response (200)
- **id** (string) - The unique identifier for the payment.
- **type** (string) - The type of the payment.
- **amount_unit** (integer) - The total amount of the payment in cents.
- **currency** (string) - The currency of the payment.
- **status** (string) - The current status of the payment (e.g., ACCEPTED, CANCELED).
- **expired** (boolean) - Indicates if the payment has expired.
- **metadata** (object) - Additional metadata for the payment.
- **sender** (object) - Information about the sender.
- **id** (string) - The sender's unique identifier.
- **type** (string) - The sender's type (e.g., CONSUMER).
- **name** (string) - The sender's name.
- **profile_pictures** (object) - Sender's profile pictures.
- **receiver** (object) - Information about the receiver.
- **id** (string) - The receiver's unique identifier.
- **type** (string) - The receiver's type (e.g., SHOP).
- **insert_date** (string) - The date and time the payment was inserted.
- **expire_date** (string) - The date and time the payment expires.
- **payment_method** (object) - Details about the payment method used.
- **meal_voucher** (object) - Details for meal voucher payments.
- **amount_unit** (integer) - The total amount of Meal Vouchers in this payment, in cents.
- **number** (integer) - The total number of Meal Vouchers in this payment.
#### Response Example
```json
{
"id": "2ee5f6c7-f85d-45b7-8f1b-2a570a7002eb",
"type": "TO_BUSINESS",
"amount_unit": 1240,
"currency": "EUR",
"status": "ACCEPTED",
"expired": false,
"metadata": {},
"sender": {
"id": "0f7c13fb-06d4-424d-8b98-18e82d1f27a8",
"type": "CONSUMER",
"name": "Emanuele C.",
"profile_pictures": {
"has_more": false,
"data": [
{
"id": "f60f9bd3-357a-4b46-8441-52d6a3bd630f",
"url": "https://placehold.co/640x640.jpg",
"width": 640,
"height": 640,
"is_original": false
},
{
"id": "33f2dc8b-de76-4287-910b-560799b60b3d",
"url": "https://placehold.co/512x512.jpg",
"width": 512,
"height": 512,
"is_original": true
},
{
"id": "f1c7d014-47dc-4c16-85d9-fc83556ab173",
"url": "https://placehold.co/180x180.jpg",
"width": 180,
"height": 180,
"is_original": false
}
]
}
},
"receiver": {
"id": "0c4f4511-1afa-4b17-b529-ff7465d126c1",
"type": "SHOP"
},
"insert_date": "2020-07-01T09:18:20.166Z",
"expire_date": "2020-07-01T11:18:20.163Z",
"payment_method": {
"meal_voucher": {
"amount_unit": 800,
"number": 1
}
}
}
```
```
--------------------------------
### Signature Protocol Request Example
Source: https://developers.satispay.com/reference/testinput
Example of a cURL request demonstrating the required headers and authorization signature format for the Satispay protocol.
```curl
curl --request POST \
--url https://staging.authservices.satispay.com/wally-services/protocol/tests/signature \
--header 'content-type: application/json' \
--header 'host: staging.authservices.satispay.com' \
--header 'date: Mon, 18 Mar 2019 15:10:24 +0000' \
--header 'digest: SHA-256=47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZG3hSuFU=' \
--header 'Authorization: Signature keyId="4ekqhmf7...", algorithm="rsa-sha256", headers="(request-target) host date digest", signature="C5yynRx..."' \
```
--------------------------------
### Payment Examples
Source: https://developers.satispay.com/reference/fringe-get-payment-details
Examples of Satispay payment objects in different states.
```APIDOC
## Payment Examples
### Description
Examples demonstrating the structure of a payment object for different statuses.
### OK - PENDING
```json
{
"id": "2ee5f6c7-f85d-45b7-8f1b-2a570a7002eb",
"code_identifier": "S6Y-PAY--2EE5F6C7-F85D-45B7-8F1B-2A570A7002EB",
"type": "TO_BUSINESS",
"amount_unit": 1240,
"currency": "EUR",
"status": "PENDING",
"expired": false,
"metadata": {
"order_id": "my_order_id",
"user_id": "my_user_id",
"payment_id": "my_payment_id",
"session_id": "my_session_id",
"key": "value"
},
"sender": {
"type": "CONSUMER"
},
"receiver": {
"id": "0c4f4511-1afa-4b17-b529-ff7465d126c1",
"type": "SHOP"
},
"insert_date": "2020-07-01T09:18:17.166Z",
"expire_date": "2020-07-01T11:18:17.163Z",
"description": "my_order_id",
"flow": "CHARGE",
"external_code": "my_order_id",
"redirect_url": "https://online.satispay.com/pay/2ee5f6c7-f85d-45b7-8f1b-2a570a7002eb?redirect_url=https%3A%2F%2Fexample.com%2Fsatispay-redirect%3Forder_id%3Dmy_order_id"
}
```
### OK - ACCEPTED
```json
{
"id": "a1b2c3d4-e5f6-7890-1234-567890abcdef",
"code_identifier": "S6Y-PAY--A1B2C3D4-E5F6-7890-1234-567890ABCDEF",
"type": "TO_BUSINESS",
"amount_unit": 1000,
"currency": "EUR",
"status": "ACCEPTED",
"expired": false,
"metadata": {
"order_id": "another_order_id"
},
"sender": {
"type": "CONSUMER"
},
"receiver": {
"id": "abcdef12-3456-7890-abcd-ef1234567890",
"type": "SHOP"
},
"insert_date": "2020-07-01T10:00:00.000Z",
"expire_date": "2020-07-01T12:00:00.000Z",
"external_code": "another_order_id",
"payment_method": {
"welfare_fringe": {
"amount_unit": 200
}
}
}
```
```
--------------------------------
### Install Satispay Plugin for Magento 2.3.x
Source: https://developers.satispay.com/docs/magento-2
Use these commands to install and enable the Satispay plugin via composer for Magento 2.3.x environments.
```shell
composer require satispay/magento2-plugin
php bin/magento module:enable Satispay_Satispay
php bin/magento setup:upgrade
php bin/magento setup:di:compile
```
--------------------------------
### Payment result callback examples
Source: https://developers.satispay.com/docs/p2p-payment-mobile-app
Examples of the callback URL structure appended with the payment result after a transaction is processed.
```text
third_party_app://callback?result={payment_id}
```
```text
third_party_app://callback?result=
```
--------------------------------
### Example Request Body for Digest Calculation
Source: https://developers.satispay.com/reference/create-the-digest
This is an example of a non-empty request body that will be used to generate the digest. Ensure the body sent matches this exactly, paying attention to newlines and spaces.
```json
{
"flow": "MATCH_CODE",
"amount_unit": 100,
"currency": "EUR"
}
```
--------------------------------
### Accept Payment API Request
Source: https://developers.satispay.com/reference/mv-update-payment
Examples for accepting a payment using the Satispay GBusiness API.
```curl
curl --request PUT \
--url https://authservices.satispay.com/g_business/v1/payments/2ee5f6c7-f85d-45b7-8f1b-2a570a7002eb \
--header 'Content-Type: application/json' \
--header 'Host: authservices.satispay.com' \
--header 'Date: Fri, 01 Jul 2024 09:18:17 GMT' \
--header 'Digest: SHA-256=...' \
--header 'Authorization: Signature keyId="4ekqhm...", algorithm="rsa-sha256", headers="(request-target) host date digest", signature="C5yynRx..."' \
--data '{
"action": "ACCEPT",
"payment_method_options": {
"meal_voucher": {
"enable": true,
"max_amount_unit": 1240,
"max_number": 8
}
},
"payment_options": {
"partial_payment": true
}
}'
```
```php
'ACCEPT',
'payment_method_options' => [
'meal_voucher' => [
'enable' => true,
'max_amount_unit' => 1240,
'max_number' => 8
]
],
'payment_options' => [
'partial_payment' => true
]
]
);
```
--------------------------------
### GET /g_business/v1/payments/{id}
Source: https://developers.satispay.com/reference/mv-get-payment-details
Retrieves details of a specific payment using its unique identifier. Includes examples for successful responses and common error scenarios.
```APIDOC
## GET /g_business/v1/payments/{id}
### Description
Retrieves the details of a specific payment by its ID.
### Method
GET
### Endpoint
`/g_business/v1/payments/{id}`
### Parameters
#### Path Parameters
- **id** (string) - Required - The unique identifier of the payment.
### Request Example
```json
{
"example": "request body"
}
```
### Response
#### Success Response (200)
- **id** (string) - The unique identifier of the payment.
- **amount** (integer) - The amount of the payment in cents.
- **status** (string) - The current status of the payment (e.g., `PAID`, `PENDING`, `FAILED`).
- **description** (string) - A description for the payment.
- **callback_url** (string) - The URL to which Satispay will send notifications about the payment status.
- **metadata** (object) - Additional key-value pairs for custom data.
#### Response Example
```json
{
"id": "2ee5f6c7-f85d-45b7-8f1b-2a570a7002eb",
"amount": 1000,
"status": "PAID",
"description": "Payment for order #123",
"callback_url": "https://yourdomain.com/satispay/callback",
"metadata": {
"order_id": "123"
}
}
```
#### Error Response (400)
- **wlt** (string) - The request CID/WLT for tracing purposes.
- **code** (string) - The system error code.
- **message** (string) - The error message.
##### Response Example (400)
```json
{
"code": 45,
"message": "Unable to fulfill the request.",
"wlt": "YmF21QrL"
}
```
#### Error Response (404)
- **wlt** (string) - The request CID/WLT for tracing purposes.
- **code** (string) - The system error code.
- **message** (string) - The error message.
##### Response Example (404)
```json
{
"code": 41,
"message": "Resource not found.",
"wlt": "QzL59KjV"
}
```
```
--------------------------------
### Advanced Web-button Initialization (Production)
Source: https://developers.satispay.com/docs/web-button-funds-lock
Configure and initialize the Satispay Web-button for advanced customization in production. Load the script and use `SatispayWebButton.configure()` to set up payment details and callbacks.
```html
```
--------------------------------
### Payment Cancellation Example
Source: https://developers.satispay.com/reference/mv-update-payment
This example shows a payment that has been canceled.
```APIDOC
## GET /payments/{id}
### Description
Retrieves the details of a specific payment.
### Method
GET
### Endpoint
/payments/{id}
### Parameters
#### Path Parameters
- **id** (string) - Required - The unique identifier of the payment.
### Response
#### Success Response (200)
- **id** (string) - The unique identifier for the payment.
- **type** (string) - The type of the payment.
- **amount_unit** (integer) - The total amount of the payment in cents.
- **currency** (string) - The currency of the payment.
- **status** (string) - The current status of the payment (e.g., ACCEPTED, CANCELED).
- **expired** (boolean) - Indicates if the payment has expired.
- **metadata** (object) - Additional metadata for the payment.
- **sender** (object) - Information about the sender.
- **receiver** (object) - Information about the receiver.
- **insert_date** (string) - The date and time the payment was inserted.
- **expire_date** (string) - The date and time the payment expires.
#### Response Example
```json
{
"id": "2ee5f6c7-f85d-45b7-8f1b-2a570a7002eb",
"type": "TO_BUSINESS",
"amount_unit": 1240,
"currency": "EUR",
"status": "CANCELED",
"expired": false,
"metadata": {},
"sender": {
"id": "0f7c13fb-06d4-424d-8b98-18e82d1f27a8",
"type": "CONSUMER",
"name": "Emanuele C.",
"profile_pictures": {
"has_more": false,
"data": [
{
"id": "f60f9bd3-357a-4b46-8441-52d6a3bd630f",
"url": "https://placehold.co/640x640.jpg",
"width": 640,
"height": 640,
"is_original": false
},
{
"id": "33f2dc8b-de76-4287-910b-560799b60b3d",
"url": "https://placehold.co/512x512.jpg",
"width": 512,
"height": 512,
"is_original": true
},
{
"id": "f1c7d014-47dc-4c16-85d9-fc83556ab173",
"url": "https://placehold.co/180x180.jpg",
"width": 180,
"height": 180,
"is_original": false
}
]
}
},
"receiver": {
"id": "0c4f4511-1afa-4b17-b529-ff7465d126c1",
"type": "SHOP"
},
"insert_date": "2020-07-01T09:18:20.166Z",
"expire_date": "2020-07-01T11:18:20.163Z"
}
```
```
--------------------------------
### MQTT Production and Sandbox Endpoints
Source: https://developers.satispay.com/reference/topic-subscription
Use these base URLs to connect to the respective MQTT environments.
```text
http://a186ick0qcrau4-ats.iot.eu-west-1.amazonaws.com
```
```text
http://a3nj958dbfb5ge.iot.eu-west-1.amazonaws.com
```
--------------------------------
### Create MATCH_CODE Payment in PHP
Source: https://developers.satispay.com/reference/mv-create-payment
Initializes a payment using the MATCH_CODE flow. Requires setting the public key, private key, and key ID before calling the Payment::create method.
```php
'MATCH_CODE',
'amount_unit' => 12.40 * 100,
'currency' => 'EUR',
'payment_method_options' => [
'meal_voucher' => [
'enable' => true,
'max_amount_unit' => 800,
'max_number' => 1
]
],
'payment_options' => [
'partial_payment' => true
],
'external_code' => 'my_order_id',
'callback_url' => 'https://example.com/satispay-callback?payment_id={uuid}',
'redirect_url' => 'https://example.com/satispay-redirect?order_id=my_order_id',
'metadata' => [
'order_id' => 'my_order_id',
'user_id' => 'my_user_id',
'payment_id' => 'my_payment_id',
'session_id' => 'my_session_id',
'key' => 'value'
]
]);
```
--------------------------------
### Advanced Web-button Initialization (Sandbox)
Source: https://developers.satispay.com/docs/web-button-funds-lock
Initialize the Satispay Web-button with custom UX in the sandbox environment. This involves loading the script from the staging URL and configuring the button with payment and event handlers.
```html
```
--------------------------------
### Create MATCH_USER Payment (PHP)
Source: https://developers.satispay.com/reference/fringe-create-payment
This PHP code snippet shows how to initiate a payment using the MATCH_USER flow. It requires the consumer's unique identifier (consumer_uid) and proper API key configuration.
```php
'MATCH_USER',
'consumer_uid' => '1ed62785-4c8d-46c3-8673-5f5d16ca9f67',
'amount_unit' => 12.40 * 100,
'currency' => 'EUR',
'payment_options' => [
'partial_payment' => true
],
'external_code' => 'my_order_id',
'callback_url' => 'https://example.com/satispay-callback?payment_id={uuid}',
'metadata' => [
'order_id' => 'my_order_id',
'user_id' => 'my_user_id',
'payment_id' => 'my_payment_id',
'session_id' => 'my_session_id',
'key' => 'value'
]
]);
```
--------------------------------
### Accept Payment via API
Source: https://developers.satispay.com/reference/update-a-payment
Examples for accepting a payment using cURL and the Satispay PHP SDK.
```curl
curl --request PUT \
--url https://authservices.satispay.com/g_business/v1/payments/2ee5f6c7-f85d-45b7-8f1b-2a570a7002eb \
--header 'Content-Type: application/json' \
--header 'Host: authservices.satispay.com' \
--header 'Date: Fri, 01 Jul 2024 09:18:17 GMT' \
--header 'Digest: SHA-256=...' \
--header 'Authorization: Signature keyId="4ekqhm...", algorithm="rsa-sha256", headers="(request-target) host date digest", signature="C5yynRx..."' \
--data '{
"action": "ACCEPT"
}'
```
```php
'ACCEPT'
]
);
```
--------------------------------
### Create a Pre-authorized Payment Token
Source: https://developers.satispay.com/reference/create-authorization
Use these examples to initiate a pre-authorized payment token request. Ensure your authentication headers or SDK credentials are correctly configured.
```curl
curl --request POST \
--url https://authservices.satispay.com/g_business/v1/pre_authorized_payment_tokens \
--header 'Content-Type: application/json' \
--header 'host: authservices.satispay.com' \
--header 'date: Fri, 28 Aug 2020 09:18:17 GMT' \
--header 'digest: SHA-256=...' \
--header 'Authorization: Signature keyId="vefn1p...", algorithm="rsa-sha256", headers="(request-target) host date digest", signature="C5yynRx..."' \
--data '{
"reason": "Monthly payment",
"callback_url": "https://myServer.com/myCallbackUrl?payment_id={uuid}",
"redirect_url": "https://myServer.com/myRedirectUrl"
}'
```
```php
\SatispayGBusiness\Api::setPublicKey("yourPublicKey");
\SatispayGBusiness\Api::setPrivateKey("yourPrivateKey");
\SatispayGBusiness\Api::setKeyId("yourKeyId");
preAuthorizedPaymentToken = \SatispayGBusiness\PreAuthorizedPaymentToken::create([
"reason" => "Monthly Payments",
"callback_url" => "https://myServer.com/myCallbackUrl?payment_id={uuid}",
"redirect_url" => "https://myServer.com/myRedirectUrl"
]);
```
--------------------------------
### Create MATCH_CODE Payment (PHP)
Source: https://developers.satispay.com/reference/fringe-create-payment
This PHP code demonstrates how to create a payment using the MATCH_CODE flow. Make sure to set your public key, private key, and key ID before making the API call. The amount should be in the smallest currency unit (e.g., cents for EUR).
```php
'MATCH_CODE',
'amount_unit' => 12.40 * 100,
'currency' => 'EUR',
'payment_options' => [
'partial_payment' => true
],
'external_code' => 'my_order_id',
'callback_url' => 'https://example.com/satispay-callback?payment_id={uuid}',
'redirect_url' => 'https://example.com/satispay-redirect?order_id=my_order_id',
'metadata' => [
'order_id' => 'my_order_id',
'user_id' => 'my_user_id',
'payment_id' => 'my_payment_id',
'session_id' => 'my_session_id',
'key' => 'value'
]
]);
```
--------------------------------
### Example Generic Error Response
Source: https://developers.satispay.com/reference/fringe-update-payment
A general example of an error response, potentially for a different status code not explicitly detailed. The `wlt` field is for tracing.
```json
{
"wlt": "RhL16Tpe",
"code": 36,
"message": "..."
}
```
--------------------------------
### Initialize Advanced Web-button
Source: https://developers.satispay.com/docs/web-button-pay
Configure a custom UI element to trigger the Satispay payment flow using the SatispayWebButton library.
```html
```
```html
```
--------------------------------
### Signature Example
Source: https://developers.satispay.com/reference/sign-the-string
This is an example of the Base64 encoded signature generated after signing the message with your private key using rsa-sha256. The signature should be appended to your API request headers.
```text
XyuV4SB3TnwXsPj5d9m/3Ju+QvegeuzDp23IpHEJ18W7gVIVUFBBraDGNSTYk4ohJfx0xsRj2B14PDLZu+z7SVeDuUQVk5mJNZnvf9lbQ0MN1W0qT/lWmsLAusDZ2TabxiDwahPNjA9ZpQOGo6sjoAGK8TSejMxffrQI0EV4mYo6KAl+sk4DGjV7GM7F/imgsw17ji1x8HpRO72slgbOPPHdjADDmGUEgSd0/MhcCHbHH6XIq+VkGSkQ83xNe1t85gQtVYh96oj6q7qz/qEhNbbGj50LhdYGv2tTtUNXU+Zk5NMNIIXwk+OmCq8mK7M/6Dmfd/prklsS7PrCCnRDnpdnRVJeFRjJMnKBc8A/ITS7jjP6vU7GZ9ltmPjPKt6/GgnZWTYjcsnqcCifyoDJt0egLimkkp8HyLWsDke08DAJHR0ylKbYc/kVwabhlZGzkDMb4DyMi4op6xp5+k8pQb6IXuI4YzraPUOblfRi/mWYUDUUfR0GPfkPIht2AjNbdvZ+bbvhsoFY57oofBQaXIcYbecQPH6la4bPADJCM3R+uFeMuMtmg7GUTl7uOOSIEs1VJRhJaBkOsuTIs3d/gk6YGOdff+1MXaopoiBxoA0+1g/9g+jVA3xQnTk9RfRzb8WHB1LkqbATHwt5rQSNQKSpvz/wCejlb566P2Ffc8w=
```
--------------------------------
### Empty Request Body Example
Source: https://developers.satispay.com/reference/create-the-digest
An example of an empty request body. Even with an empty body, a digest must be generated following the same hashing and encoding steps.
```json
```
--------------------------------
### Create PRE_AUTHORIZED Payment with PHP
Source: https://developers.satispay.com/reference/create-a-payment
This PHP code demonstrates how to create a PRE_AUTHORIZED payment using the Satispay SDK. Ensure you have set your public key, private key, and key ID.
```php
'PRE_AUTHORIZED',
'token' => '6d508316-24d0-4f5c-83f0-49c94bb99847',
'amount_unit' => 12.40 * 100,
'currency' => 'EUR',
'external_code' => 'my_order_id',
'metadata' => [
'order_id' => 'my_order_id',
'user_id' => 'my_user_id',
'payment_id' => 'my_payment_id',
'session_id' => 'my_session_id',
'key' => 'value'
]
]);
```
--------------------------------
### Create REFUND Payment with PHP
Source: https://developers.satispay.com/reference/create-a-payment
This PHP code demonstrates how to initiate a refund for a previous payment using the Satispay SDK. Provide the necessary payment details.
```php
'REFUND',
'amount_unit' => 12.40 * 100,
'currency' => 'EUR',
'parent_payment_uid' => '2ee5f6c7-f85d-45b7-8f1b-2a570a7002eb',
'external_code' => 'my_order_id'
]);
```
--------------------------------
### POST /g_business/v1/mqtt_certificates
Source: https://developers.satispay.com/reference/create-mqtt-certificates
Creates a new PEM certificate and private key for a shop MQTT device.
```APIDOC
## POST /g_business/v1/mqtt_certificates
### Description
API to create a PEM certificate and the private key for a shop mqtt device.
### Method
POST
### Endpoint
https://authservices.satispay.com/g_business/v1/mqtt_certificates
### Parameters
#### Header Parameters
- **Host** (string) - Required - The host declared in the signature
- **Date** (string) - Required - The date declared in the signature
- **Digest** (string) - Required - The digest declared in the signature
- **Authorization** (string) - Required - Signature of the request
### Response
#### Success Response (200)
- **uid** (string) - Unique identifier for the certificate
- **shop_uid** (string) - Unique identifier for the shop
- **certificate_pem** (string) - The generated PEM certificate
- **private_key** (string) - The generated private key
#### Response Example
{
"uid": "ba3ddcaa-b19b-4476-9747-d8256131d6c0",
"shop_uid": "866f0500-d2a8-4f11-b118-7d5777ecc7a9",
"certificate_pem": "-----BEGIN CERTIFICATE-----\nMIIDWjCCAkKgAwIBAgIVAIC7Wnz....",
"private_key": "-----BEGIN RSA PRIVATE KEY-----\nMIIEpQIBAAKCAQEA6p79gcqNGfZ...."
}
```
--------------------------------
### OpenAPI Definition for Get Consumer
Source: https://developers.satispay.com/reference/retrive-consumer
This JSON object defines the OpenAPI 3.1.0 specification for the 'Get consumer' API endpoint. It includes details on the request parameters, expected responses, and security schemes.
```json
{
"openapi": "3.1.0",
"info": {
"title": "production",
"version": "1.7.1"
},
"servers": [
{
"url": "https://authservices.satispay.com"
}
],
"security": [
{}
],
"paths": {
"/g_business/v1/consumers/{phone_number}": {
"get": {
"summary": "Get consumer",
"description": "API to retrieve a customer uid from the phone number",
"operationId": "retrive-consumer",
"parameters": [
{
"name": "phone_number",
"in": "path",
"description": "The phone number formatted with its prefix (eg. +390000000000)",
"schema": {
"type": "string"
},
"required": true
},
{
"name": "Host",
"in": "header",
"description": "The host declared in the signature",
"required": true,
"schema": {
"type": "string"
}
},
{
"name": "Date",
"in": "header",
"description": "The date declared in the signature",
"required": true,
"schema": {
"type": "string"
}
},
{
"name": "Digest",
"in": "header",
"description": "The digest declared in the signature",
"required": true,
"schema": {
"type": "string"
}
},
{
"name": "Authorization",
"in": "header",
"description": "Signature of the request",
"required": true,
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "200",
"content": {
"application/json": {
"examples": {
"Result": {
"value": "{\n \"id\": \"889ab18d-b319-490c-8899-c350c076a901\"\n}"
}
},
"schema": {
"type": "object",
"properties": {
"id": {
"type": "string",
"example": "889ab18d-b319-490c-8899-c350c076a901"
}
}
}
}
}
},
"403": {
"description": "403",
"content": {
"text/plain": {
"examples": {
"Result": {
"value": "Authorization header not present or invalid"
}
}
}
}
}
},
"deprecated": false,
"security": [],
"x-readme": {
"code-samples": [
{
"language": "curl",
"code": "curl --request GET \
--url 'https://authservices.satispay.com/g_business/v1/consumers/+390000000000' \
--header 'host: authservices.satispay.com' \
--header 'date: Fri, 28 Aug 2020 09:18:17 GMT' \
--header 'digest: SHA-256=...' \
--header 'Authorization: Signature keyId=\"vefn1p...\", algorithm=\"rsa-sha256\", headers=\"(request-target) host date digest\", signature=\"C5yynRx...""
},
{
"language": "php",
"code": "\SatispayGBusiness\Api::setPublicKey(\"yourPublicKey\");\n\SatispayGBusiness\Api::setPrivateKey(\"yourPrivateKey\");\n\SatispayGBusiness\Api::setKeyId(\"yourKeyId\");\n\n$payment = \SatispayGBusiness\Consumer::get(\"+390000000000\");"
}
],
"samples-languages": [
"curl",
"php"
]
}
}
}
},
"x-readme": {
"headers": [],
"explorer-enabled": false,
"proxy-enabled": false
},
"x-readme-fauxas": true
}
```