Agreements
POST/ agreements/{id}/resend-sms
Payments
Authenticate
Clients
Subscribers
GET/ agreements
View list of agreements
Name | Description |
---|---|
Parameters | |
client_id | Use 'client_id' param to get payments only for specified clients (for account users only). If 'client_id' is not used, client and account as user types will get by default first available client |
page | List specific page |
per_page | Items per page |
date_from | Agreements created on and after date (yyyy-mm-dd) |
date_to | Agreements created on and before date (yyyy-mm-dd) |
{ "current_page": 1, "data": [ { "0": "response_text", "id": 1, "user_id": "1", "company_id": "1", "subscriber_id": "1", "subscriber": { "firstname": "John", "lastname": "Doe", "phone": "22233313", "email": "email@test.com", "address_1": "Address1", "address_2": "", "zip": "111111", "city": "City" }, "campaign_id": "", "membership_number": "", "amount": "10.00", "frequency": "2", "plan_name": "Test 27", "tags": [], "comments": "", "cpr": null, "custom_1": null, "custom_data": { "test": "data" }, "status": "Canceled", "requested_text": "string", "response_code": "201", "object_json": null, "next_payment_date": "2019-04-07 00:00:00", "from_iframe": null, "created_at": "2019-03-12 11:18:02", "updated_at": "2019-03-28 10:36:11", "agreement_id": "0f5dda9a-e7a6-4299-8467-8de7ef015beb", "full_name": "John doe", "request": { "external_id": "EXTID", "amount": "10", "currency": "DKK", "description": "Description", "next_payment_date": "2019-03-21", "frequency": "2", "links": [ { "rel": "user-redirect", "href": "https://api-domain/ap1/agreement/id/1" }, { "rel": "success-callback", "href": "https://api-domain/api/callback/1/success" }, { "rel": "cancel-callback", "href": "https://api-domain/api/callback/1/cancel" } ], "country_code": "DK", "plan": "Test 27", "tags": [], "expiration_timeout_minutes": 20160, "mobile_phone_number": "11111111111" } }, { "0": "response_text", "id": 1, "user_id": "1", "company_id": "1", "subscriber_id": "1", "subscriber": { "firstname": "John", "lastname": "Doe", "phone": "22233313", "email": "email@test.com", "address_1": "Address1", "address_2": "", "zip": "111111", "city": "City" }, "campaign_id": "", "membership_number": "", "amount": "10.00", "frequency": "2", "plan_name": "Test 27", "tags": [], "comments": "", "cpr": null, "custom_1": null, "custom_data": { "test": "data" }, "status": "Canceled", "requested_text": "string", "response_code": "201", "object_json": null, "next_payment_date": "2019-04-07 00:00:00", "from_iframe": null, "created_at": "2019-03-12 11:18:02", "updated_at": "2019-03-28 10:36:11", "agreement_id": "0f5dda9a-e7a6-4299-8467-8de7ef015beb", "full_name": "John doe", "request": { "external_id": "EXTID", "amount": "10", "currency": "DKK", "description": "Description", "next_payment_date": "2019-03-21", "frequency": "2", "links": [ { "rel": "user-redirect", "href": "https://api-domain/ap1/agreement/id/1" }, { "rel": "success-callback", "href": "https://api-domain/api/callback/1/success" }, { "rel": "cancel-callback", "href": "https://api-domain/api/callback/1/cancel" } ], "country_code": "DK", "plan": "Test 27", "tags": [], "expiration_timeout_minutes": 20160, "mobile_phone_number": "11111111111" } } ], "from": 1, "last_page": 1, "next_page_url": null, "path": "http://api-domain/api/agreements", "per_page": 20, "prev_page_url": null, "to": 20, "total": 2 }
POST/ agreements
Create agreement
Name | Description |
---|---|
Parameters | |
client_id | client_id |
phone | phone number |
amount | amount |
frequency | frequency |
plan_name | plan name |
firstname | First name |
lastname | Last name |
address_1 | address_1 |
address_2 | address_2 |
zip | zip code |
city | city |
next_payment_date | Next payment date. date_format:d.m.Y (ex: 01.09.2020) |
comments | comments |
cpr | cpr |
oo_amount | One off payment amount when creeating agreement |
oo_description | One off payment description max 60 chars |
custom_1 | custom_1 |
custom_data | Custom data - must be valid JSON string |
tags | Tags for the agreement - comma (,) separated string of tags |
{ "error": false, "status": "Created", "code": 201, "message": "Agreement created successfully", "id": 1000 }
{
“error”: true, “status”: “Bad request”, “code”: 400, “message”: “You should choose company”
}
{
“error”: true, “status”: “Unauthorized”, “code”: 401, “message”: “MobilePay Auth required”
}
GET/ agreements/ {id}
Update agreement
Name | Description |
---|---|
Parameters | |
id | Agreement id |
{ "0": "response_text", "id": 1, "user_id": "1", "company_id": "1", "subscriber_id": "1", "subscriber": { "firstname": "John", "lastname": "Doe", "phone": "22233313", "email": "email@test.com", "address_1": "Address1", "address_2": "", "zip": "111111", "city": "City" }, "campaign_id": "", "membership_number": "", "amount": "10.00", "frequency": "2", "plan_name": "Test 27", "tags": [], "comments": "", "cpr": null, "custom_1": null, "custom_data": { "test": "data" }, "status": "Canceled", "requested_text": "string", "response_code": "201", "object_json": null, "next_payment_date": "2019-04-07 00:00:00", "from_iframe": null, "created_at": "2019-03-12 11:18:02", "updated_at": "2019-03-28 10:36:11", "agreement_id": "0f5dda9a-e7a6-4299-8467-8de7ef015beb", "full_name": "John doe", "request": { "external_id": "EXTID", "amount": "10", "currency": "DKK", "description": "Description", "next_payment_date": "2019-03-21", "frequency": "2", "links": [ { "rel": "user-redirect", "href": "https://api-domain/ap1/agreement/id/1" }, { "rel": "success-callback", "href": "https://api-domain/api/callback/1/success" }, { "rel": "cancel-callback", "href": "https://api-domain/api/callback/1/cancel" } ], "country_code": "DK", "plan": "Test 27", "tags": [], "expiration_timeout_minutes": 20160, "mobile_phone_number": "11111111111" } }
{
“error”: true, “status”: “Unauthorized”, “code”: 401, “message”: “Permission error”
}
{
“error”: true, “status”: “Not Found”, “code”: 404, “message”: “No query results for model Agreement 23232332”
}
PUT/ agreements/ {id}
Update an agreement based on id
Name | Description |
---|---|
Parameters | |
id | Agreement id |
amount | amount |
frequency | Every: 365 - day, 52 - week, 26 - 2 weeks, 12 - month, 4 - 3 months, 2 - 6 months, 1 - * year |
{ "error": false, "status": "Updated", "code": 200, "message": "Agreement updated successfully" }
{
"error": true, "status": "Bad request", "code": 400, "message": "You should choose company"
}
{
"error": true, "status": "Unauthorized", "code": 401, "message": "MobilePay Auth required"
}
POST/ agreements/{id}/cancel
Cancel an agreement based on id
Name | Description |
---|---|
Parameters | |
id | Agreement id |
{ "error": false, "status": "Canceled", "code": 204, "message": "Agreement canceled successfully" }
{
"error": true, "status": "Bad request", "code": 400, "message": "You should choose company"
}
{
“error”: true, “status”: “Unauthorized”, “code”: 401, “message”: “MobilePay Auth required”
}
POST/ agreements/{id}/resend-sms
Resend SMS for agreement with provided ID
Name | Description |
---|---|
Parameters | |
id | Agreement id |
{ "error": false, "status": "Canceled", "code": 204, "message": "Agreement canceled successfully" }
{
“error”: true, “status”: “Unauthorized”, “code”: 401, “message”: “MobilePay Auth required”
}
Agreement is not pending or SMS already sent.
Payments
GET/agreements/{id}/payments
Get payments in a specific agreement
Name | Description |
---|---|
Parameters | |
id | Filter payment results based on agreement id. |
page | List specific page |
per_page | Items per page |
{ "current_page": 1, "data": [ { "id": 1, "agreement_id": "2", "request_text": "text", "response_text": null, "object_json": null, "payment_type": "subscription_payment", "status": "Created", "created_at": "2018-07-23 17:07:25", "updated_at": "2018-07-23 17:07:26", "request": { "agreement_id": "agreementID", "amount": "11", "due_date": "2018-04-27", "next_payment_date": "2018-05-27", "external_id": "id", "description": "Subscribe Payment" }, "response": null, "payment_id": null, "refund_id": null }, { "id": 2, "agreement_id": "2", "request_text": "text", "response_text": null, "object_json": null, "payment_type": "subscription_payment", "status": "Created", "created_at": "2018-07-23 17:07:25", "updated_at": "2018-07-23 17:07:26", "request": { "agreement_id": "id-id-id-id-id", "amount": "11", "due_date": "2018-04-27", "next_payment_date": "2018-05-27", "external_id": "id", "description": "Subscribe Payment" }, "response": null, "payment_id": null, "refund_id": null } ], "from": 1, "last_page": 1, "next_page_url": null, "path": "http://api-domain/api/agreements/212212/payments", "per_page": 20, "prev_page_url": null, "to": 1, "total": 2 }
{
“error”: true, “status”: “Not Found”, “code”: 404, “message”: “No query results for model Agreement 23232332”
}
GET/ payments
Get all payments
Name | Description |
---|---|
Parameters | |
client_id | Use 'client_id' param to get payments only for specified clients (for account users only). If 'client_id' is not used, an account user type will get by default payments from all available clients |
status | Payments with specified status. Available statuses: Scheduled, Executed, Canceled, Declined, Failed, Suspended, Rejected, Created, Reserved, Captured, Expired, Invalid, Issued. For further info on these statuses, check here: http://support.paygate.dk/paygate-subscriptions/subscriptions-getting-started/agreement-payment-statuses/ |
page | List specific page |
per_page | Items per page |
date_from | Payments created on and after date (yyyy-mm-dd) |
date_to | Payments created on and before date (yyyy-mm-dd) |
updated_from | Payments updated on and after date (yyyy-mm-dd) |
updated_to | Payments updated on and before date (yyyy-mm-dd) |
{ "current_page": 1, "data": [ { "id": 111111, "agreement_id": "1111111111", "request_text": "request_text", "response_text": "response_text", "object_json": "object_json", "payment_type": "subscription_payment", "status": "Executed", "created_at": "2019-03-12 22:07:42", "updated_at": "2019-03-28 09:06:10", "request": { "agreement_id": "uuid", "amount": "10", "due_date": "2019-03-21", "next_payment_date": "2019-09-20", "external_id": "SP358", "description": "Subscribe Payment" }, "response": { "payment_id": "3333-6430-4681-a6f2-873894b10b0a", "external_id": "SP358" }, "payment_id": "23838a54-6430-4681-a6f2-873894b10b0a", "refund_id": null } ], "from": 1, "last_page": 41, "next_page_url": "http://api-domain/api/payments?page=2", "path": "http://api-domain/api/payments", "per_page": 1, "prev_page_url": null, "to": 1, "total": 41 }
GET /payments/{id}
Get specific payment details
Name | Description |
---|---|
Parameters | |
id | Payment id |
{ "id": 111, "agreement_id": "123", "request_text": "requested text", "response_text": "response_text", "object_json": "object json", "payment_type": "subscription_payment", "status": "Executed", "created_at": "2019-03-12 22:07:42", "updated_at": "2019-03-28 09:06:10", "request": { "agreement_id": "0f5dda9a-e7a6-4299-8467-8de7ef015beb", "amount": "10", "due_date": "2019-03-21", "next_payment_date": "2019-09-20", "external_id": "SP358", "description": "Subscribe Payment" }, "response": { "payment_id": "23838a54-6430-4681-a6f2-873894b10b0a", "external_id": "SP358" }, "payment_id": "23838a54-6430-4681-a6f2-873894b10b0a", "refund_id": null }
{
“error”: true, “status”: “Not Found”, “code”: 404, “message”: “No query results for model Payment 23232332”
}
POST/payments/{id}/cancel
Cancel payment
Name | Description |
---|---|
Parameters | |
id | Payment id |
{ "error": false, "status": "Canceled", "code": 204, "message": "Payment canceled successfully" }
{
“error”: true, “status”: “Bad request”, “code”: 400, “message”: “api error code message”
}
{
“error”: true, “status”: “Unauthorized”, “code”: 401, “message”: “MobilePay Auth required”
}
{
“error”: true, “status”: “Not Found”, “code”: 404, “message”: “No query results for model Payment 23232332”
}
POST/payments/{id}/refund
Refund payment based on id
Name | Description |
---|---|
Parameters | |
id | Payment id |
{ "error": false, "status": "Refunded", "code": 200, "message": "Payment refunded successfully" }
{
“error”: true, “status”: “Bad request”, “code”: 400, “message”: “api error code message”
}
{
"error": true, "status": "Unauthorized", "code": 401, "message": "MobilePay Auth required"
}
{ "error": true, "status": "Not Found", "code": 404, "message": "No query results for model Payment 23232332" }
Authenticate
POST/auth
Authenticate to API
Name | Description |
---|---|
Parameters | |
grant_type | Used grant type |
client_id | client id |
client_secret | client secret |
username | user email |
password | user password |
token | refresh token (used only for refresh_token as grant type ) |
{ "token_type": "Bearer", "expires_in": 3600, "access_token": "access_token", "refresh_token": "refresh_token" }
{ “error”: “invalid_client”, “message”: “Client authentication failed” }
Clients
GET/clients
Get all clients
Name | Description |
---|---|
Parameters | |
No parameters |
{ "clients": [ { "id": 6565656, "name": "Client name", "redirect_url": "https://redirect-url.com", "created_at": "2019-03-12 11:10:19", "pivot": { "user_id": "userID", "company_id": "companyID" } } ] }
GET/clients/{id}
Get client details
Name | Description |
---|---|
Parameters | |
id | id |
{ "id": 9999, "name": "Client Name", "redirect_url": "redirect url", "created_at": "2019-03-12 11:10:19" }
{
“error”: true, “status”: “Not Found”, “code”: 404, “message”: “No query results for model Client 23232332”
}
Subscribers
GET/subscribers
Get all subscribers
Name | Description |
---|---|
Parameters | |
client_id | Use 'client_id' param to get payments only for specified clients (for account users only). If 'client_id' is not used, client and account as user types will get by default first available client |
page | List specific page |
per_page | Items per page |
{ "current_page": 1, "data": [ { "firstname": null, "lastname": null, "email": null, "phone": "49790111", "created_at": "2019-03-27 14:21:35", "agreement_count": "1", "agreement_id": null, "full_name": "Unnamed", "request": null } ], "from": 1, "last_page": 25, "next_page_url": "http://api-domain/api/subscribers?page=2", "path": "http://api-domain/api/subscribers", "per_page": 1, "prev_page_url": null, "to": 1, "total": 25 }
GET/subscribers/{phoneNumber}
Get specific subscriber’s details
Name | Description |
---|---|
Parameters | |
phoneNumber | Get specific subscriber’s details based on their phone number |
client_id | Use 'client_id' param to get payments only for specified clients (for account users only). If 'client_id' is not used, client and account as user types will get by default first available client |
{ "firstname": null, "lastname": null, "email": null, "phone": "49790111", "created_at": "2019-03-27 14:21:35", "agreement_count": "1", "agreement_id": null, "full_name": "Unnamed", "request": null }
{
“error”: true, “status”: “Not Found”, “code”: 404, “message”: “Subscriber not found”
}
GET/subscribers/{phoneNumber}/agreements
Get agreements on a specific subscriber
Name | Description |
---|---|
Parameters | |
phoneNumber | Get transactions on a specific subscriber based on subscriber phone number |
client_id | Use 'client_id' param to get payments only for specified clients (for account users only). If 'client_id' is not used, client and account as user types will get by default first available client |
page | List specific page |
per_page | Items per page |
{ "current_page": 1, "data": [ { "id": 11111, "user_id": "1111111", "company_id": "13", "firstname": null, "lastname": null, "phone": "49790111", "email": null, "address_1": null, "address_2": null, "zip": null, "city": null, "campaign_id": null, "membership_number": null, "amount": "10.00", "frequency": "26", "plan_name": "Test plan12", "comments": null, "cpr": null, "custom_1": null, "status": "Canceled", "request_text": "request_text", "response_text": "response_text", "response_code": "201", "object_json": null, "next_payment_date": "2019-05-05 00:00:00", "from_iframe": null, "created_at": "2019-03-27 14:21:35", "updated_at": "2019-03-27 14:38:50", "agreement_id": "91609f95-188a-433a-bb4b-458d55be4ba4", "full_name": "Unnamed", "request": { "external_id": "11111STRING", "amount": "10", "currency": "DKK", "description": "Description", "next_payment_date": "2019-05-05", "frequency": "26", "links": [ { "rel": "user-redirect", "href": "https://api-domain/agreement/id/111" }, { "rel": "success-callback", "href": "https://api-domain/api/callback/111/success" }, { "rel": "cancel-callback", "href": "https://api-domain/api/callback/111/cancel" } ], "country_code": "DK", "plan": "Test plan12", "expiration_timeout_minutes": 20160, "mobile_phone_number": "4549790111" } } ], "from": 1, "last_page": 1, "next_page_url": null, "path": "http://api-domain/api/subscribers/49790111/agreements", "per_page": 20, "prev_page_url": null, "to": 1, "total": 1 }
GET/subscribers/{phoneNumber}/transactions
Get agreements on a specific subscriber
Name | Description |
---|---|
Parameters | |
phoneNumber | Get transactions on a specific subscriber based on subscriber phone number |
client_id | Use 'client_id' param to get payments only for specified clients (for account users only). If 'client_id' is not used, client and account as user types will get by default first available client |
page | List specific page |
per_page | Items per page |
{ "current_page": 1, "data": [ { "id": 111111, "agreement_id": "1111111111", "request_text": "request_text", "response_text": "response_text", "object_json": "object_json", "payment_type": "subscription_payment", "status": "Executed", "created_at": "2019-03-12 22:07:42", "updated_at": "2019-03-28 09:06:10", "request": { "agreement_id": "uuid", "amount": "10", "due_date": "2019-03-21", "next_payment_date": "2019-09-20", "external_id": "SP358", "description": "Subscribe Payment" }, "response": { "payment_id": "3333-6430-4681-a6f2-873894b10b0a", "external_id": "SP358" }, "payment_id": "23838a54-6430-4681-a6f2-873894b10b0a", "refund_id": null } ], "from": 1, "last_page": 41, "next_page_url": "http://api-domain/api/payments?page=2", "path": "http://api-domain/api/payments", "per_page": 1, "prev_page_url": null, "to": 1, "total": 41 }