Event
It allows the creation of events and later check their status.
https://app.payku.cl/ (Default server) · https://des.payku.cl/ (Sandbox server)Create an event
Section titled “Create an event”/api/eventThis method allows you to create an event and receive the event details as a response.
Request body
| Parameter | Type | Description |
|---|---|---|
eventrequired |
string | Event id. |
namerequired |
string | Event name. |
date_eventrequired |
datetime | Date on which the event will take place. |
date_closing_salesrequired |
datetime | Sales closing date, must be less than or equal to date_event. |
date_paymentrequired |
datetime | Payment date of the event, must be greater than the date_event date. |
url_event |
string <url> | url where the event is published. |
url_logo |
string <url> | url of the logo that identifies the event. |
service_sale |
integer | Amount of the sales service, belongs to the amount that the owner of the account will receive per transaction. |
affiliation |
array of objects | Distribution of beneficiaries. |
email |
string | Beneficiary email. |
percent |
number | Percentage which corresponds to the beneficiary. |
curl -X POST \ https://BASE_URL/api/event \ -H 'Accept: application/json, text/plain, */*' \ -H 'Authorization: Bearer TOKEN_PUBLICO' \ -H 'Content-Type: application/json' \ -H 'Host: BASE_URL' \ -d { "name": "Event", "event": "98374", "date_event": "2020-12-20", "date_payment": "2020-12-22", "date_closing_sales": "2020-12-19 23:59:00", "url_logo": "https://example.cl/logo_event1.png", "url_event": "https://example.cl/event1", "service_sale": 10, "affiliation": [ ["[email protected]", 50], ["[email protected]", 50] ] }'$client = new \GuzzleHttp\Client(); $body = $client->request('POST', 'https://BASE_URL/api/event', [ 'json' => [ 'name' => 'Event', 'event' => '98374', 'date_event' => '2020-12-20', 'date_payment' => '2020-12-22', 'date_closing_sales' => '2020-12-19 23:59:00', 'url_logo' => 'https://example.cl/logo_event1.png', 'url_event' => 'https://example.cl/event1', 'service_sale' => 10, 'affiliation' => [ ] ], 'headers' => [ 'Authorization' => 'Bearer PUBLIC-TOKEN' ] ])->getBody();$response = json_decode($body);const request = async (data) => { const response = await fetch('https://BASE_URL/api/event', { method: 'POST', headers: { 'Content-Type': 'application/json', 'Authorization': 'Bearer PUBLIC-TOKEN' }, body: JSON.stringify(data) }); const result = await response.json(); console.log(result)}
let data = { name: "Event", event: "98374", date_event: "2020-12-20", date_payment: "2020-12-22", date_closing_sales: "2020-12-19 23:59:00", url_logo: "https://example.cl/logo_event1.png", url_event: "https://example.cl/event1", service_sale: 10, affiliation: [ ]};
request(data);Responses
{ "status": "success", "id": "98374", "event": "Event", "date_event": "2020-12-20", "date_payment": "2020-12-22", "date_closing_sales": "2020-12-19 23:59:00", "url_logo": "https://example.cl/logo_event1.png", "url_event": "https://example.cl/event1", "distribution": { "affiliate": "100.00", "service_sale": "10.00" }, "affiliation": { "id": "b99dfd8193ebfd37d4b9", "percent": "100.00", "status": "pending" }, "paymentData": { "count": 0, "amount_general": 0, "amount_affiliate": 0, "fee": 0, "balance": 0 }}Response fields
| Parameter | Type | Description |
|---|---|---|
status |
string | Request status. |
id |
string | Event id. |
event |
string | Event name. |
date_event |
datetime | Date on which the event will take place. |
date_payment |
datetime | Payment date of the event, must be greater than the date_event date. |
date_closing_sales |
datetime | Sales closing date, must be less than or equal to date_event. |
url_logo |
string <url> | url that belongs to the event. |
url_event |
string <url> | url where the event is published. |
distribution |
object | Distribution of transactions. |
affiliate |
string | Amount to distribute to beneficiaries. |
service_sale |
string | Amount to distribute in the sales service. |
affiliation |
object | Affiliate information. |
id |
string | Beneficiary identifier. |
email |
string | Beneficiary email. |
percent |
string | Percentage which corresponds to the beneficiary. |
status |
string | Beneficiary status. |
paymentData |
object | Distribution of beneficiaries. |
count |
number | Sales quantity. |
amount_general |
number | General amount of all transactions. |
amount_affiliate |
number | Amount to distribute to beneficiaries. |
fee |
number | Fee. |
balance |
number | Amount to deposit. |
Request failed.
{ "status": "failed", "type": "Unprocessable Entity", "message_error": "subject:invalid,amount:is empty,email:is empty,order:invalid"}Response fields
| Parameter | Type | Description |
|---|---|---|
status |
string | Request status. |
type |
string | Type of error. |
message_error |
string | Error message. |
Incorrect public token.
{ "type": "Unauthorized", "message_error": { "error": "waiting token public" }}Response fields
| Parameter | Type | Description |
|---|---|---|
type |
string | Request status. |
message_error |
object | |
error |
string | Error message. |
Get event details
Section titled “Get event details”/api/event/{idEvent}This method allows obtaining the details of an event.
Path parameters
| Parameter | Type | Description |
|---|---|---|
idrequired |
string | id of the event to request |
curl -X GET \ https://BASE_URL/api/event \ -H 'Accept: application/json, text/plain, */*' \ -H 'Authorization: Bearer TOKEN_PUBLICO' \ -H 'Content-Type: application/json' \ -H 'Host: BASE_URL' \$client = new \GuzzleHttp\Client(); $body = $client->request('GET', 'https://BASE_URL/api/event/98374', [ 'headers' => [ 'Authorization' => 'Bearer PUBLIC-TOKEN' ] ])->getBody();$response = json_decode($body);const request = async (data) => { const response = await fetch('https://BASE_URL/api/event/98374', { method: 'GET', headers: { 'Content-Type': 'application/json', 'Authorization': 'Bearer PUBLIC-TOKEN' }, }); const result = await response.json(); console.log(result)}
request(data);Responses
{ "id": "98374", "event": "Event", "date_event": "2020-12-20", "date_payment": "2020-12-22", "date_closing_sales": "2020-12-19 23:59:00", "url_logo": "https://example.cl/logo_event1.png", "url_event": "https://example.cl/event1", "distribution": { "affiliate": "100.00", "service_sale": "10.00" }, "affiliation": { "id": "b99dfd8193ebfd37d4b9", "percent": "100.00", "status": "pending" }, "paymentData": { "count": 0, "amount_general": 0, "amount_affiliate": 0, "fee": 0, "balance": 0 }}Response fields
| Parameter | Type | Description |
|---|---|---|
id |
string | Event identifier. |
event |
string | Event name. |
date_event |
datetime | Date on which the event will take place. |
date_payment |
datetime | Payment date of the event, must be greater than the date_event date. |
date_closing_sales |
datetime | Sales closing date, must be less than or equal to date_event. |
url_logo |
string <url> | url logo that belongs to the event. |
url_event |
string <url> | url that belongs to the event. |
distribution |
object | Distribution of transactions. |
affiliate |
string | Amount to distribute to beneficiaries. |
service_sale |
string | Amount to distribute in the sales service. |
affiliation |
object | Affiliate information. |
id |
string | Beneficiary identifier. |
email |
string | Beneficiary email. |
percent |
string | Percentage which corresponds to the beneficiary. |
status |
string | Beneficiary status. |
paymentData |
object | Distribution of beneficiaries. |
count |
number | Sales quantity. |
amount_general |
number | General amount of all transactions. |
amount_affiliate |
number | Amount to distribute to beneficiaries. |
fee |
number | Fee. |
balance |
number | Amount to deposit. |
Request failed.
{ "status": "failed", "type": "Unprocessable Entity", "message_error": "subject:invalid,amount:is empty,email:is empty,order:invalid"}Response fields
| Parameter | Type | Description |
|---|---|---|
status |
string | Request status. |
type |
string | Type of error. |
message_error |
string | Error message. |
Incorrect public token.
{ "type": "Unauthorized", "message_error": { "error": "waiting token public" }}Response fields
| Parameter | Type | Description |
|---|---|---|
type |
string | Request status. |
message_error |
object | |
error |
string | Error message. |