Tap2pay v1.1.0
Scroll down for code samples, example requests and responses. Select a language for code samples from the tabs above or the mobile navigation menu.
Base URLs:
License: MIT
Authentication
- HTTP Authentication, scheme: bearer
Invoices
getInvoice
Code samples
# You can also use wget
curl -X GET https://secure.tap2pay.me/api/invoices/{id} \
-H 'Accept: application/json' \
-H 'Authorization: Bearer {access-token}'
GET https://secure.tap2pay.me/api/invoices/{id} HTTP/1.1
Host: secure.tap2pay.me
Accept: application/json
var headers = {
'Accept':'application/json',
'Authorization':'Bearer {access-token}'
};
$.ajax({
url: 'https://secure.tap2pay.me/api/invoices/{id}',
method: 'get',
headers: headers,
success: function(data) {
console.log(JSON.stringify(data));
}
})
const fetch = require('node-fetch');
const headers = {
'Accept':'application/json',
'Authorization':'Bearer {access-token}'
};
fetch('https://secure.tap2pay.me/api/invoices/{id}',
{
method: 'GET',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json',
'Authorization' => 'Bearer {access-token}'
}
result = RestClient.get 'https://secure.tap2pay.me/api/invoices/{id}',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Accept': 'application/json',
'Authorization': 'Bearer {access-token}'
}
r = requests.get('https://secure.tap2pay.me/api/invoices/{id}', params={
}, headers = headers)
print r.json()
URL obj = new URL("https://secure.tap2pay.me/api/invoices/{id}");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Accept": []string{"application/json"},
"Authorization": []string{"Bearer {access-token}"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("GET", "https://secure.tap2pay.me/api/invoices/{id}", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
GET /invoices/{id}
Get invoice
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
id | path | string | true | ID of invoice to fetch |
Example responses
200 Response
{
"id": "string",
"status": "created",
"amount": "string",
"amount_value": 0,
"amount_currency": "string",
"billing_agreement_id": "string",
"description": "string",
"custom": "string",
"created_at": 0,
"telegram_start_link": "string",
"facebook_start_link": "string",
"viber_start_link": "string",
"web_checkout_link": "string",
"successful_payment_id": "string",
"items": [
{
"name": "string",
"product_id": "string",
"description": "string",
"quantity": 0,
"price_value": 0,
"price_currency": "string"
}
]
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | Invoice | Invoice |
listInvoices
Code samples
# You can also use wget
curl -X GET https://secure.tap2pay.me/api/invoices \
-H 'Accept: application/json' \
-H 'Authorization: Bearer {access-token}'
GET https://secure.tap2pay.me/api/invoices HTTP/1.1
Host: secure.tap2pay.me
Accept: application/json
var headers = {
'Accept':'application/json',
'Authorization':'Bearer {access-token}'
};
$.ajax({
url: 'https://secure.tap2pay.me/api/invoices',
method: 'get',
headers: headers,
success: function(data) {
console.log(JSON.stringify(data));
}
})
const fetch = require('node-fetch');
const headers = {
'Accept':'application/json',
'Authorization':'Bearer {access-token}'
};
fetch('https://secure.tap2pay.me/api/invoices',
{
method: 'GET',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json',
'Authorization' => 'Bearer {access-token}'
}
result = RestClient.get 'https://secure.tap2pay.me/api/invoices',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Accept': 'application/json',
'Authorization': 'Bearer {access-token}'
}
r = requests.get('https://secure.tap2pay.me/api/invoices', params={
}, headers = headers)
print r.json()
URL obj = new URL("https://secure.tap2pay.me/api/invoices");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Accept": []string{"application/json"},
"Authorization": []string{"Bearer {access-token}"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("GET", "https://secure.tap2pay.me/api/invoices", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
GET /invoices
List all invoices
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
page | query | integer(int32) | false | Page of invoices |
Example responses
200 Response
{
"current_page": 0,
"total_pages": 0,
"total_count": 0,
"items": [
{
"id": "string",
"status": "created",
"amount": "string",
"amount_value": 0,
"amount_currency": "string",
"billing_agreement_id": "string",
"description": "string",
"custom": "string",
"created_at": 0,
"telegram_start_link": "string",
"facebook_start_link": "string",
"viber_start_link": "string",
"web_checkout_link": "string",
"successful_payment_id": "string",
"items": [
{
"name": "string",
"product_id": "string",
"description": "string",
"quantity": 0,
"price_value": 0,
"price_currency": "string"
}
]
}
]
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | A paged array of invoices | Invoices |
createInvoice
Code samples
# You can also use wget
curl -X POST https://secure.tap2pay.me/api/invoices \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: Bearer {access-token}'
POST https://secure.tap2pay.me/api/invoices HTTP/1.1
Host: secure.tap2pay.me
Content-Type: application/json
Accept: application/json
var headers = {
'Content-Type':'application/json',
'Accept':'application/json',
'Authorization':'Bearer {access-token}'
};
$.ajax({
url: 'https://secure.tap2pay.me/api/invoices',
method: 'post',
headers: headers,
success: function(data) {
console.log(JSON.stringify(data));
}
})
const fetch = require('node-fetch');
const inputBody = '{
"invoice": {
"description": "string",
"gateway_name": "string",
"custom": "string",
"billing_agreement": {
"title": "string",
"description": "string"
},
"items": [
{
"name": "string",
"description": "string",
"product_id": "string",
"quantity": 0,
"price_value": 0,
"price_currency": "string"
}
]
}
}';
const headers = {
'Content-Type':'application/json',
'Accept':'application/json',
'Authorization':'Bearer {access-token}'
};
fetch('https://secure.tap2pay.me/api/invoices',
{
method: 'POST',
body: inputBody,
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'Authorization' => 'Bearer {access-token}'
}
result = RestClient.post 'https://secure.tap2pay.me/api/invoices',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Authorization': 'Bearer {access-token}'
}
r = requests.post('https://secure.tap2pay.me/api/invoices', params={
}, headers = headers)
print r.json()
URL obj = new URL("https://secure.tap2pay.me/api/invoices");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Content-Type": []string{"application/json"},
"Accept": []string{"application/json"},
"Authorization": []string{"Bearer {access-token}"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("POST", "https://secure.tap2pay.me/api/invoices", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
POST /invoices
Create invoice
Body parameter
{
"invoice": {
"description": "string",
"gateway_name": "string",
"custom": "string",
"billing_agreement": {
"title": "string",
"description": "string"
},
"items": [
{
"name": "string",
"description": "string",
"product_id": "string",
"quantity": 0,
"price_value": 0,
"price_currency": "string"
}
]
}
}
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
body | body | NewInvoice | true | none |
Example responses
200 Response
{
"id": "string",
"status": "created",
"amount": "string",
"amount_value": 0,
"amount_currency": "string",
"billing_agreement_id": "string",
"description": "string",
"custom": "string",
"created_at": 0,
"telegram_start_link": "string",
"facebook_start_link": "string",
"viber_start_link": "string",
"web_checkout_link": "string",
"successful_payment_id": "string",
"items": [
{
"name": "string",
"product_id": "string",
"description": "string",
"quantity": 0,
"price_value": 0,
"price_currency": "string"
}
]
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | Invoice created | Invoice |
422 | Unprocessable Entity | Validation errors | Errors |
Products
getProduct
Code samples
# You can also use wget
curl -X GET https://secure.tap2pay.me/api/products/{id} \
-H 'Accept: application/json' \
-H 'Authorization: Bearer {access-token}'
GET https://secure.tap2pay.me/api/products/{id} HTTP/1.1
Host: secure.tap2pay.me
Accept: application/json
var headers = {
'Accept':'application/json',
'Authorization':'Bearer {access-token}'
};
$.ajax({
url: 'https://secure.tap2pay.me/api/products/{id}',
method: 'get',
headers: headers,
success: function(data) {
console.log(JSON.stringify(data));
}
})
const fetch = require('node-fetch');
const headers = {
'Accept':'application/json',
'Authorization':'Bearer {access-token}'
};
fetch('https://secure.tap2pay.me/api/products/{id}',
{
method: 'GET',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json',
'Authorization' => 'Bearer {access-token}'
}
result = RestClient.get 'https://secure.tap2pay.me/api/products/{id}',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Accept': 'application/json',
'Authorization': 'Bearer {access-token}'
}
r = requests.get('https://secure.tap2pay.me/api/products/{id}', params={
}, headers = headers)
print r.json()
URL obj = new URL("https://secure.tap2pay.me/api/products/{id}");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Accept": []string{"application/json"},
"Authorization": []string{"Bearer {access-token}"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("GET", "https://secure.tap2pay.me/api/products/{id}", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
GET /products/{id}
Get product
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
id | path | string | true | ID of product to fetch |
Example responses
200 Response
{
"id": "string",
"price": "string",
"price_value": 0,
"price_currency": "string",
"description": "string",
"custom_id": "string",
"created_at": 0,
"telegram_start_link": "string",
"facebook_start_link": "string",
"viber_start_link": "string",
"web_checkout_link": "string",
"price_fields": [{"amount": 0, "currency": "string"}]
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | Product | Product |
updateProduct
Code samples
# You can also use wget
curl -X PUT https://secure.tap2pay.me/api/products/{id} \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: Bearer {access-token}'
PUT https://secure.tap2pay.me/api/products/{id} HTTP/1.1
Host: secure.tap2pay.me
Content-Type: application/json
Accept: application/json
var headers = {
'Content-Type':'application/json',
'Accept':'application/json',
'Authorization':'Bearer {access-token}'
};
$.ajax({
url: 'https://secure.tap2pay.me/api/products/{id}',
method: 'put',
headers: headers,
success: function(data) {
console.log(JSON.stringify(data));
}
})
const fetch = require('node-fetch');
const inputBody = '{
"product": {
"name": "string",
"description": "string",
"image_url": "http://example.com",
"custom_id": "string",
"price_value": 0,
"price_currency": "string",
"price_fields": [{"amount": 0, "currency": "string"}]
}
}';
const headers = {
'Content-Type':'application/json',
'Accept':'application/json',
'Authorization':'Bearer {access-token}'
};
fetch('https://secure.tap2pay.me/api/products/{id}',
{
method: 'PUT',
body: inputBody,
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'Authorization' => 'Bearer {access-token}'
}
result = RestClient.put 'https://secure.tap2pay.me/api/products/{id}',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Authorization': 'Bearer {access-token}'
}
r = requests.put('https://secure.tap2pay.me/api/products/{id}', params={
}, headers = headers)
print r.json()
URL obj = new URL("https://secure.tap2pay.me/api/products/{id}");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("PUT");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Content-Type": []string{"application/json"},
"Accept": []string{"application/json"},
"Authorization": []string{"Bearer {access-token}"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("PUT", "https://secure.tap2pay.me/api/products/{id}", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
PUT /products/{id}
Update product
Body parameter
{
"product": {
"name": "string",
"description": "string",
"image_url": "http://example.com",
"custom_id": "string",
"price_value": 0,
"price_currency": "string",
"price_fields": [{"amount": 0, "currency": "string"}]
}
}
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
id | path | string | true | ID of product to update |
body | body | NewProduct | true | none |
Example responses
200 Response
{
"id": "string",
"price": "string",
"price_value": 0,
"price_currency": "string",
"description": "string",
"custom_id": "string",
"created_at": 0,
"telegram_start_link": "string",
"facebook_start_link": "string",
"viber_start_link": "string",
"web_checkout_link": "string",
"price_fields": [{"amount": 0, "currency": "string"}]
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | Product updated | Product |
422 | Unprocessable Entity | Validation errors | Errors |
deleteProduct
Code samples
# You can also use wget
curl -X DELETE https://secure.tap2pay.me/api/products/{id} \
-H 'Accept: application/json' \
-H 'Authorization: Bearer {access-token}'
DELETE https://secure.tap2pay.me/api/products/{id} HTTP/1.1
Host: secure.tap2pay.me
Accept: application/json
var headers = {
'Accept':'application/json',
'Authorization':'Bearer {access-token}'
};
$.ajax({
url: 'https://secure.tap2pay.me/api/products/{id}',
method: 'delete',
headers: headers,
success: function(data) {
console.log(JSON.stringify(data));
}
})
const fetch = require('node-fetch');
const headers = {
'Accept':'application/json',
'Authorization':'Bearer {access-token}'
};
fetch('https://secure.tap2pay.me/api/products/{id}',
{
method: 'DELETE',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json',
'Authorization' => 'Bearer {access-token}'
}
result = RestClient.delete 'https://secure.tap2pay.me/api/products/{id}',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Accept': 'application/json',
'Authorization': 'Bearer {access-token}'
}
r = requests.delete('https://secure.tap2pay.me/api/products/{id}', params={
}, headers = headers)
print r.json()
URL obj = new URL("https://secure.tap2pay.me/api/products/{id}");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("DELETE");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Accept": []string{"application/json"},
"Authorization": []string{"Bearer {access-token}"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("DELETE", "https://secure.tap2pay.me/api/products/{id}", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
DELETE /products/{id}
Delete product
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
id | path | string | true | ID of product to delete |
Example responses
422 Response
{
"errors": [
"string"
]
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | Product deleted | None |
422 | Unprocessable Entity | Validation errors | Errors |
listProducts
Code samples
# You can also use wget
curl -X GET https://secure.tap2pay.me/api/products \
-H 'Accept: application/json' \
-H 'Authorization: Bearer {access-token}'
GET https://secure.tap2pay.me/api/products HTTP/1.1
Host: secure.tap2pay.me
Accept: application/json
var headers = {
'Accept':'application/json',
'Authorization':'Bearer {access-token}'
};
$.ajax({
url: 'https://secure.tap2pay.me/api/products',
method: 'get',
headers: headers,
success: function(data) {
console.log(JSON.stringify(data));
}
})
const fetch = require('node-fetch');
const headers = {
'Accept':'application/json',
'Authorization':'Bearer {access-token}'
};
fetch('https://secure.tap2pay.me/api/products',
{
method: 'GET',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json',
'Authorization' => 'Bearer {access-token}'
}
result = RestClient.get 'https://secure.tap2pay.me/api/products',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Accept': 'application/json',
'Authorization': 'Bearer {access-token}'
}
r = requests.get('https://secure.tap2pay.me/api/products', params={
}, headers = headers)
print r.json()
URL obj = new URL("https://secure.tap2pay.me/api/products");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Accept": []string{"application/json"},
"Authorization": []string{"Bearer {access-token}"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("GET", "https://secure.tap2pay.me/api/products", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
GET /products
List all products
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
page | query | integer(int32) | false | Page of products |
Example responses
200 Response
{
"current_page": 0,
"total_pages": 0,
"total_count": 0,
"items": [
{
"id": "string",
"price": "string",
"price_value": 0,
"price_currency": "string",
"description": "string",
"custom_id": "string",
"created_at": 0,
"telegram_start_link": "string",
"facebook_start_link": "string",
"viber_start_link": "string",
"web_checkout_link": "string",
"price_fields": [{"amount": 0, "currency": "string"}]
}
]
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | A paged array of products | Products |
createProduct
Code samples
# You can also use wget
curl -X POST https://secure.tap2pay.me/api/products \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: Bearer {access-token}'
POST https://secure.tap2pay.me/api/products HTTP/1.1
Host: secure.tap2pay.me
Content-Type: application/json
Accept: application/json
var headers = {
'Content-Type':'application/json',
'Accept':'application/json',
'Authorization':'Bearer {access-token}'
};
$.ajax({
url: 'https://secure.tap2pay.me/api/products',
method: 'post',
headers: headers,
success: function(data) {
console.log(JSON.stringify(data));
}
})
const fetch = require('node-fetch');
const inputBody = '{
"product": {
"name": "string",
"description": "string",
"image_url": "http://example.com",
"custom_id": "string",
"price_value": 0,
"price_currency": "string",
"price_fields": [{"amount": 0, "currency": "string"}]
}
}';
const headers = {
'Content-Type':'application/json',
'Accept':'application/json',
'Authorization':'Bearer {access-token}'
};
fetch('https://secure.tap2pay.me/api/products',
{
method: 'POST',
body: inputBody,
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'Authorization' => 'Bearer {access-token}'
}
result = RestClient.post 'https://secure.tap2pay.me/api/products',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Authorization': 'Bearer {access-token}'
}
r = requests.post('https://secure.tap2pay.me/api/products', params={
}, headers = headers)
print r.json()
URL obj = new URL("https://secure.tap2pay.me/api/products");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Content-Type": []string{"application/json"},
"Accept": []string{"application/json"},
"Authorization": []string{"Bearer {access-token}"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("POST", "https://secure.tap2pay.me/api/products", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
POST /products
Create Product
Body parameter
{
"product": {
"name": "string",
"description": "string",
"image_url": "http://example.com",
"custom_id": "string",
"price_value": 0,
"price_currency": "string",
"price_fields": [{"amount": 0, "currency": "string"}]
}
}
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
body | body | NewProduct | true | none |
Example responses
200 Response
{
"id": "string",
"price": "string",
"price_value": 0,
"price_currency": "string",
"description": "string",
"custom_id": "string",
"created_at": 0,
"telegram_start_link": "string",
"facebook_start_link": "string",
"viber_start_link": "string",
"web_checkout_link": "string",
"price_fields": [{"amount": 0, "currency": "string"}]
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | Product created | Product |
422 | Unprocessable Entity | Validation errors | Errors |
Subscriptions
getSubscription
Code samples
# You can also use wget
curl -X GET https://secure.tap2pay.me/api/subscriptions/{id} \
-H 'Accept: application/json' \
-H 'Authorization: Bearer {access-token}'
GET https://secure.tap2pay.me/api/subscriptions/{id} HTTP/1.1
Host: secure.tap2pay.me
Accept: application/json
var headers = {
'Accept':'application/json',
'Authorization':'Bearer {access-token}'
};
$.ajax({
url: 'https://secure.tap2pay.me/api/subscriptions/{id}',
method: 'get',
headers: headers,
success: function(data) {
console.log(JSON.stringify(data));
}
})
const fetch = require('node-fetch');
const headers = {
'Accept':'application/json',
'Authorization':'Bearer {access-token}'
};
fetch('https://secure.tap2pay.me/api/subscriptions/{id}',
{
method: 'GET',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json',
'Authorization' => 'Bearer {access-token}'
}
result = RestClient.get 'https://secure.tap2pay.me/api/subscriptions/{id}',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Accept': 'application/json',
'Authorization': 'Bearer {access-token}'
}
r = requests.get('https://secure.tap2pay.me/api/subscriptions/{id}', params={
}, headers = headers)
print r.json()
URL obj = new URL("https://secure.tap2pay.me/api/subscriptions/{id}");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Accept": []string{"application/json"},
"Authorization": []string{"Bearer {access-token}"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("GET", "https://secure.tap2pay.me/api/subscriptions/{id}", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
GET /subscriptions/{id}
Get Subscription
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
id | path | string | true | ID of subscription to fetch |
Example responses
200 Response
{
"title": "string",
"image_url": "http://example.com",
"custom": "string",
"billing_cycle_term": "day",
"billing_cycle_frequency": 0,
"amount_value": 0,
"amount_currency": "string",
"first_amount_value": 0,
"first_amount_currency": "string",
"id": "string",
"state": "created",
"amount": "string",
"paid_through": 0,
"created_at": 0,
"billing_cycle": "string",
"billing_agreement_id": "string",
"current_invoice": {
"id": "string",
"state": "string",
"created_at": 0,
"telegram_start_link": "http://example.com",
"facebook_start_link": "http://example.com",
"viber_start_link": "http://example.com",
"web_checkout_link": "http://example.com"
}
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | Subscription | Subscription |
updateSubscription
Code samples
# You can also use wget
curl -X PUT https://secure.tap2pay.me/api/subscriptions/{id} \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: Bearer {access-token}'
PUT https://secure.tap2pay.me/api/subscriptions/{id} HTTP/1.1
Host: secure.tap2pay.me
Content-Type: application/json
Accept: application/json
var headers = {
'Content-Type':'application/json',
'Accept':'application/json',
'Authorization':'Bearer {access-token}'
};
$.ajax({
url: 'https://secure.tap2pay.me/api/subscriptions/{id}',
method: 'put',
headers: headers,
success: function(data) {
console.log(JSON.stringify(data));
}
})
const fetch = require('node-fetch');
const inputBody = '{
"subscription": {
"title": "string",
"image_url": "http://example.com",
"custom": "string",
"billing_cycle_term": "day",
"billing_cycle_frequency": 0,
"amount_value": 0,
"amount_currency": "string",
"first_amount_value": 0,
"first_amount_currency": "string"
}
}';
const headers = {
'Content-Type':'application/json',
'Accept':'application/json',
'Authorization':'Bearer {access-token}'
};
fetch('https://secure.tap2pay.me/api/subscriptions/{id}',
{
method: 'PUT',
body: inputBody,
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'Authorization' => 'Bearer {access-token}'
}
result = RestClient.put 'https://secure.tap2pay.me/api/subscriptions/{id}',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Authorization': 'Bearer {access-token}'
}
r = requests.put('https://secure.tap2pay.me/api/subscriptions/{id}', params={
}, headers = headers)
print r.json()
URL obj = new URL("https://secure.tap2pay.me/api/subscriptions/{id}");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("PUT");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Content-Type": []string{"application/json"},
"Accept": []string{"application/json"},
"Authorization": []string{"Bearer {access-token}"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("PUT", "https://secure.tap2pay.me/api/subscriptions/{id}", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
PUT /subscriptions/{id}
Update subscription
Body parameter
{
"subscription": {
"title": "string",
"image_url": "http://example.com",
"custom": "string",
"billing_cycle_term": "day",
"billing_cycle_frequency": 0,
"amount_value": 0,
"amount_currency": "string",
"first_amount_value": 0,
"first_amount_currency": "string"
}
}
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
id | path | string | true | ID of subscription to update |
body | body | NewSubscription | true | none |
Example responses
200 Response
{
"title": "string",
"image_url": "http://example.com",
"custom": "string",
"billing_cycle_term": "day",
"billing_cycle_frequency": 0,
"amount_value": 0,
"amount_currency": "string",
"first_amount_value": 0,
"first_amount_currency": "string",
"id": "string",
"state": "created",
"amount": "string",
"paid_through": 0,
"created_at": 0,
"billing_cycle": "string",
"billing_agreement_id": "string",
"current_invoice": {
"id": "string",
"state": "string",
"created_at": 0,
"telegram_start_link": "http://example.com",
"facebook_start_link": "http://example.com",
"viber_start_link": "http://example.com",
"web_checkout_link": "http://example.com"
}
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | Subscription updated | Subscription |
422 | Unprocessable Entity | Validation errors | Errors |
cancelSubscription
Code samples
# You can also use wget
curl -X DELETE https://secure.tap2pay.me/api/subscriptions/{id} \
-H 'Accept: application/json' \
-H 'Authorization: Bearer {access-token}'
DELETE https://secure.tap2pay.me/api/subscriptions/{id} HTTP/1.1
Host: secure.tap2pay.me
Accept: application/json
var headers = {
'Accept':'application/json',
'Authorization':'Bearer {access-token}'
};
$.ajax({
url: 'https://secure.tap2pay.me/api/subscriptions/{id}',
method: 'delete',
headers: headers,
success: function(data) {
console.log(JSON.stringify(data));
}
})
const fetch = require('node-fetch');
const headers = {
'Accept':'application/json',
'Authorization':'Bearer {access-token}'
};
fetch('https://secure.tap2pay.me/api/subscriptions/{id}',
{
method: 'DELETE',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json',
'Authorization' => 'Bearer {access-token}'
}
result = RestClient.delete 'https://secure.tap2pay.me/api/subscriptions/{id}',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Accept': 'application/json',
'Authorization': 'Bearer {access-token}'
}
r = requests.delete('https://secure.tap2pay.me/api/subscriptions/{id}', params={
}, headers = headers)
print r.json()
URL obj = new URL("https://secure.tap2pay.me/api/subscriptions/{id}");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("DELETE");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Accept": []string{"application/json"},
"Authorization": []string{"Bearer {access-token}"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("DELETE", "https://secure.tap2pay.me/api/subscriptions/{id}", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
DELETE /subscriptions/{id}
Cancel subscription
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
id | path | string | true | ID of subscription to cancel |
Example responses
200 Response
{
"title": "string",
"image_url": "http://example.com",
"custom": "string",
"billing_cycle_term": "day",
"billing_cycle_frequency": 0,
"amount_value": 0,
"amount_currency": "string",
"first_amount_value": 0,
"first_amount_currency": "string",
"id": "string",
"state": "created",
"amount": "string",
"paid_through": 0,
"created_at": 0,
"billing_cycle": "string",
"billing_agreement_id": "string",
"current_invoice": {
"id": "string",
"state": "string",
"created_at": 0,
"telegram_start_link": "http://example.com",
"facebook_start_link": "http://example.com",
"viber_start_link": "http://example.com",
"web_checkout_link": "http://example.com"
}
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | Subscription canceled | Subscription |
422 | Unprocessable Entity | Validation errors | Errors |
pauseSubscription
Code samples
# You can also use wget
curl -X PUT https://secure.tap2pay.me/api/subscriptions/{id}/pause \
-H 'Accept: application/json' \
-H 'Authorization: Bearer {access-token}'
PUT https://secure.tap2pay.me/api/subscriptions/{id}/pause HTTP/1.1
Host: secure.tap2pay.me
Accept: application/json
var headers = {
'Accept':'application/json',
'Authorization':'Bearer {access-token}'
};
$.ajax({
url: 'https://secure.tap2pay.me/api/subscriptions/{id}/pause',
method: 'put',
headers: headers,
success: function(data) {
console.log(JSON.stringify(data));
}
})
const fetch = require('node-fetch');
const headers = {
'Accept':'application/json',
'Authorization':'Bearer {access-token}'
};
fetch('https://secure.tap2pay.me/api/subscriptions/{id}/pause',
{
method: 'PUT',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json',
'Authorization' => 'Bearer {access-token}'
}
result = RestClient.put 'https://secure.tap2pay.me/api/subscriptions/{id}/pause',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Accept': 'application/json',
'Authorization': 'Bearer {access-token}'
}
r = requests.put('https://secure.tap2pay.me/api/subscriptions/{id}/pause', params={
}, headers = headers)
print r.json()
URL obj = new URL("https://secure.tap2pay.me/api/subscriptions/{id}/pause");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("PUT");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Accept": []string{"application/json"},
"Authorization": []string{"Bearer {access-token}"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("PUT", "https://secure.tap2pay.me/api/subscriptions/{id}/pause", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
PUT /subscriptions/{id}/pause
Pause active or past_due subscription
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
id | path | string | true | ID of subscription to update |
Example responses
200 Response
{
"title": "string",
"image_url": "http://example.com",
"custom": "string",
"billing_cycle_term": "day",
"billing_cycle_frequency": 0,
"amount_value": 0,
"amount_currency": "string",
"first_amount_value": 0,
"first_amount_currency": "string",
"id": "string",
"state": "created",
"amount": "string",
"paid_through": 0,
"created_at": 0,
"billing_cycle": "string",
"billing_agreement_id": "string",
"current_invoice": {
"id": "string",
"state": "string",
"created_at": 0,
"telegram_start_link": "http://example.com",
"facebook_start_link": "http://example.com",
"viber_start_link": "http://example.com",
"web_checkout_link": "http://example.com"
}
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | Subscription paused | Subscription |
422 | Unprocessable Entity | Validation errors | Errors |
activateSubscription
Code samples
# You can also use wget
curl -X PUT https://secure.tap2pay.me/api/subscriptions/{id}/activate \
-H 'Accept: application/json' \
-H 'Authorization: Bearer {access-token}'
PUT https://secure.tap2pay.me/api/subscriptions/{id}/activate HTTP/1.1
Host: secure.tap2pay.me
Accept: application/json
var headers = {
'Accept':'application/json',
'Authorization':'Bearer {access-token}'
};
$.ajax({
url: 'https://secure.tap2pay.me/api/subscriptions/{id}/activate',
method: 'put',
headers: headers,
success: function(data) {
console.log(JSON.stringify(data));
}
})
const fetch = require('node-fetch');
const headers = {
'Accept':'application/json',
'Authorization':'Bearer {access-token}'
};
fetch('https://secure.tap2pay.me/api/subscriptions/{id}/activate',
{
method: 'PUT',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json',
'Authorization' => 'Bearer {access-token}'
}
result = RestClient.put 'https://secure.tap2pay.me/api/subscriptions/{id}/activate',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Accept': 'application/json',
'Authorization': 'Bearer {access-token}'
}
r = requests.put('https://secure.tap2pay.me/api/subscriptions/{id}/activate', params={
}, headers = headers)
print r.json()
URL obj = new URL("https://secure.tap2pay.me/api/subscriptions/{id}/activate");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("PUT");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Accept": []string{"application/json"},
"Authorization": []string{"Bearer {access-token}"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("PUT", "https://secure.tap2pay.me/api/subscriptions/{id}/activate", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
PUT /subscriptions/{id}/activate
Activate paused subscription
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
id | path | string | true | ID of subscription to update |
Example responses
200 Response
{
"title": "string",
"image_url": "http://example.com",
"custom": "string",
"billing_cycle_term": "day",
"billing_cycle_frequency": 0,
"amount_value": 0,
"amount_currency": "string",
"first_amount_value": 0,
"first_amount_currency": "string",
"id": "string",
"state": "created",
"amount": "string",
"paid_through": 0,
"created_at": 0,
"billing_cycle": "string",
"billing_agreement_id": "string",
"current_invoice": {
"id": "string",
"state": "string",
"created_at": 0,
"telegram_start_link": "http://example.com",
"facebook_start_link": "http://example.com",
"viber_start_link": "http://example.com",
"web_checkout_link": "http://example.com"
}
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | Subscription activated | Subscription |
422 | Unprocessable Entity | Validation errors | Errors |
listSubscriptions
Code samples
# You can also use wget
curl -X GET https://secure.tap2pay.me/api/subscriptions \
-H 'Accept: application/json' \
-H 'Authorization: Bearer {access-token}'
GET https://secure.tap2pay.me/api/subscriptions HTTP/1.1
Host: secure.tap2pay.me
Accept: application/json
var headers = {
'Accept':'application/json',
'Authorization':'Bearer {access-token}'
};
$.ajax({
url: 'https://secure.tap2pay.me/api/subscriptions',
method: 'get',
headers: headers,
success: function(data) {
console.log(JSON.stringify(data));
}
})
const fetch = require('node-fetch');
const headers = {
'Accept':'application/json',
'Authorization':'Bearer {access-token}'
};
fetch('https://secure.tap2pay.me/api/subscriptions',
{
method: 'GET',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json',
'Authorization' => 'Bearer {access-token}'
}
result = RestClient.get 'https://secure.tap2pay.me/api/subscriptions',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Accept': 'application/json',
'Authorization': 'Bearer {access-token}'
}
r = requests.get('https://secure.tap2pay.me/api/subscriptions', params={
}, headers = headers)
print r.json()
URL obj = new URL("https://secure.tap2pay.me/api/subscriptions");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Accept": []string{"application/json"},
"Authorization": []string{"Bearer {access-token}"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("GET", "https://secure.tap2pay.me/api/subscriptions", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
GET /subscriptions
List all subscriptions
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
page | query | integer(int32) | false | Page of Subscriptions |
Example responses
200 Response
{
"current_page": 0,
"total_pages": 0,
"total_count": 0,
"items": [
{
"title": "string",
"image_url": "http://example.com",
"custom": "string",
"billing_cycle_term": "day",
"billing_cycle_frequency": 0,
"amount_value": 0,
"amount_currency": "string",
"first_amount_value": 0,
"first_amount_currency": "string",
"id": "string",
"state": "created",
"amount": "string",
"paid_through": 0,
"created_at": 0,
"billing_cycle": "string",
"billing_agreement_id": "string",
"current_invoice": {
"id": "string",
"state": "string",
"created_at": 0,
"telegram_start_link": "http://example.com",
"facebook_start_link": "http://example.com",
"viber_start_link": "http://example.com",
"web_checkout_link": "http://example.com"
}
}
]
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | A paged array of subscriptions | Subscriptions |
createSubscription
Code samples
# You can also use wget
curl -X POST https://secure.tap2pay.me/api/subscriptions \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: Bearer {access-token}'
POST https://secure.tap2pay.me/api/subscriptions HTTP/1.1
Host: secure.tap2pay.me
Content-Type: application/json
Accept: application/json
var headers = {
'Content-Type':'application/json',
'Accept':'application/json',
'Authorization':'Bearer {access-token}'
};
$.ajax({
url: 'https://secure.tap2pay.me/api/subscriptions',
method: 'post',
headers: headers,
success: function(data) {
console.log(JSON.stringify(data));
}
})
const fetch = require('node-fetch');
const inputBody = '{
"subscription": {
"title": "string",
"image_url": "http://example.com",
"custom": "string",
"billing_cycle_term": "day",
"billing_cycle_frequency": 0,
"amount_value": 0,
"amount_currency": "string",
"first_amount_value": 0,
"first_amount_currency": "string"
}
}';
const headers = {
'Content-Type':'application/json',
'Accept':'application/json',
'Authorization':'Bearer {access-token}'
};
fetch('https://secure.tap2pay.me/api/subscriptions',
{
method: 'POST',
body: inputBody,
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'Authorization' => 'Bearer {access-token}'
}
result = RestClient.post 'https://secure.tap2pay.me/api/subscriptions',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Authorization': 'Bearer {access-token}'
}
r = requests.post('https://secure.tap2pay.me/api/subscriptions', params={
}, headers = headers)
print r.json()
URL obj = new URL("https://secure.tap2pay.me/api/subscriptions");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Content-Type": []string{"application/json"},
"Accept": []string{"application/json"},
"Authorization": []string{"Bearer {access-token}"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("POST", "https://secure.tap2pay.me/api/subscriptions", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
POST /subscriptions
Create Subscription
Body parameter
{
"subscription": {
"title": "string",
"image_url": "http://example.com",
"custom": "string",
"billing_cycle_term": "day",
"billing_cycle_frequency": 0,
"amount_value": 0,
"amount_currency": "string",
"first_amount_value": 0,
"first_amount_currency": "string"
}
}
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
body | body | NewSubscription | true | none |
Example responses
200 Response
{
"title": "string",
"image_url": "http://example.com",
"custom": "string",
"billing_cycle_term": "day",
"billing_cycle_frequency": 0,
"amount_value": 0,
"amount_currency": "string",
"first_amount_value": 0,
"first_amount_currency": "string",
"id": "string",
"state": "created",
"amount": "string",
"paid_through": 0,
"created_at": 0,
"billing_cycle": "string",
"billing_agreement_id": "string",
"current_invoice": {
"id": "string",
"state": "string",
"created_at": 0,
"telegram_start_link": "http://example.com",
"facebook_start_link": "http://example.com",
"viber_start_link": "http://example.com",
"web_checkout_link": "http://example.com"
}
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | Subscription | Subscription |
422 | Unprocessable Entity | Validation errors | Errors |
Payments
getPayment
Code samples
# You can also use wget
curl -X GET https://secure.tap2pay.me/api/payments/{id} \
-H 'Accept: application/json' \
-H 'Authorization: Bearer {access-token}'
GET https://secure.tap2pay.me/api/payments/{id} HTTP/1.1
Host: secure.tap2pay.me
Accept: application/json
var headers = {
'Accept':'application/json',
'Authorization':'Bearer {access-token}'
};
$.ajax({
url: 'https://secure.tap2pay.me/api/payments/{id}',
method: 'get',
headers: headers,
success: function(data) {
console.log(JSON.stringify(data));
}
})
const fetch = require('node-fetch');
const headers = {
'Accept':'application/json',
'Authorization':'Bearer {access-token}'
};
fetch('https://secure.tap2pay.me/api/payments/{id}',
{
method: 'GET',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json',
'Authorization' => 'Bearer {access-token}'
}
result = RestClient.get 'https://secure.tap2pay.me/api/payments/{id}',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Accept': 'application/json',
'Authorization': 'Bearer {access-token}'
}
r = requests.get('https://secure.tap2pay.me/api/payments/{id}', params={
}, headers = headers)
print r.json()
URL obj = new URL("https://secure.tap2pay.me/api/payments/{id}");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Accept": []string{"application/json"},
"Authorization": []string{"Bearer {access-token}"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("GET", "https://secure.tap2pay.me/api/payments/{id}", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
GET /payments/{id}
Get payment
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
id | path | string | true | ID of payment to fetch |
Example responses
200 Response
{
"id": "string",
"state": "pending",
"invoice_id": "string",
"billing_agreement_id": "string",
"merchant_transaction_id": "string"
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | Payment | Payment |
getPaymentByMerchantTransactionId
Code samples
# You can also use wget
curl -X GET https://secure.tap2pay.me/api/payments/merchant_transaction_id/{id} \
-H 'Accept: application/json' \
-H 'Authorization: Bearer {access-token}'
GET https://secure.tap2pay.me/api/payments/merchant_transaction_id/{id} HTTP/1.1
Host: secure.tap2pay.me
Accept: application/json
var headers = {
'Accept':'application/json',
'Authorization':'Bearer {access-token}'
};
$.ajax({
url: 'https://secure.tap2pay.me/api/payments/merchant_transaction_id/{id}',
method: 'get',
headers: headers,
success: function(data) {
console.log(JSON.stringify(data));
}
})
const fetch = require('node-fetch');
const headers = {
'Accept':'application/json',
'Authorization':'Bearer {access-token}'
};
fetch('https://secure.tap2pay.me/api/payments/merchant_transaction_id/{id}',
{
method: 'GET',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json',
'Authorization' => 'Bearer {access-token}'
}
result = RestClient.get 'https://secure.tap2pay.me/api/payments/merchant_transaction_id/{id}',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Accept': 'application/json',
'Authorization': 'Bearer {access-token}'
}
r = requests.get('https://secure.tap2pay.me/api/payments/merchant_transaction_id/{id}', params={
}, headers = headers)
print r.json()
URL obj = new URL("https://secure.tap2pay.me/api/payments/merchant_transaction_id/{id}");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Accept": []string{"application/json"},
"Authorization": []string{"Bearer {access-token}"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("GET", "https://secure.tap2pay.me/api/payments/merchant_transaction_id/{id}", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
GET /payments/merchant_transaction_id/{id}
Get payment by merchant transaction id
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
id | path | string | true | Merchant transaction ID of payment to fetch |
Example responses
200 Response
{
"id": "string",
"state": "pending",
"invoice_id": "string",
"billing_agreement_id": "string",
"merchant_transaction_id": "string"
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | Payment | Payment |
createPayment
Code samples
# You can also use wget
curl -X POST https://secure.tap2pay.me/api/payments \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: Bearer {access-token}'
POST https://secure.tap2pay.me/api/payments HTTP/1.1
Host: secure.tap2pay.me
Content-Type: application/json
Accept: application/json
var headers = {
'Content-Type':'application/json',
'Accept':'application/json',
'Authorization':'Bearer {access-token}'
};
$.ajax({
url: 'https://secure.tap2pay.me/api/payments',
method: 'post',
headers: headers,
success: function(data) {
console.log(JSON.stringify(data));
}
})
const fetch = require('node-fetch');
const inputBody = '{
"payment": {
"invoice_id": "string",
"billing_agreement_id": "string",
"merchant_transaction_id": "string"
}
}';
const headers = {
'Content-Type':'application/json',
'Accept':'application/json',
'Authorization':'Bearer {access-token}'
};
fetch('https://secure.tap2pay.me/api/payments',
{
method: 'POST',
body: inputBody,
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'Authorization' => 'Bearer {access-token}'
}
result = RestClient.post 'https://secure.tap2pay.me/api/payments',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Authorization': 'Bearer {access-token}'
}
r = requests.post('https://secure.tap2pay.me/api/payments', params={
}, headers = headers)
print r.json()
URL obj = new URL("https://secure.tap2pay.me/api/payments");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Content-Type": []string{"application/json"},
"Accept": []string{"application/json"},
"Authorization": []string{"Bearer {access-token}"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("POST", "https://secure.tap2pay.me/api/payments", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
POST /payments
Create payment
In Tap2pay payments are asynchronous. When payment is created, it will be added to queue for processing. Your may get status via getPayment
operation or receive payment status via webhook.
Body parameter
{
"payment": {
"invoice_id": "string",
"billing_agreement_id": "string",
"merchant_transaction_id": "string"
}
}
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
body | body | NewPayment | true | none |
Example responses
200 Response
{
"id": "string",
"state": "pending",
"invoice_id": "string",
"billing_agreement_id": "string",
"merchant_transaction_id": "string"
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | Payment | Payment |
422 | Unprocessable Entity | Validation errors | Errors |
BillingAgreements
getBillingAgreement
Code samples
# You can also use wget
curl -X GET https://secure.tap2pay.me/api/billing_agreements/{id} \
-H 'Accept: application/json' \
-H 'Authorization: Bearer {access-token}'
GET https://secure.tap2pay.me/api/billing_agreements/{id} HTTP/1.1
Host: secure.tap2pay.me
Accept: application/json
var headers = {
'Accept':'application/json',
'Authorization':'Bearer {access-token}'
};
$.ajax({
url: 'https://secure.tap2pay.me/api/billing_agreements/{id}',
method: 'get',
headers: headers,
success: function(data) {
console.log(JSON.stringify(data));
}
})
const fetch = require('node-fetch');
const headers = {
'Accept':'application/json',
'Authorization':'Bearer {access-token}'
};
fetch('https://secure.tap2pay.me/api/billing_agreements/{id}',
{
method: 'GET',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json',
'Authorization' => 'Bearer {access-token}'
}
result = RestClient.get 'https://secure.tap2pay.me/api/billing_agreements/{id}',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Accept': 'application/json',
'Authorization': 'Bearer {access-token}'
}
r = requests.get('https://secure.tap2pay.me/api/billing_agreements/{id}', params={
}, headers = headers)
print r.json()
URL obj = new URL("https://secure.tap2pay.me/api/billing_agreements/{id}");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Accept": []string{"application/json"},
"Authorization": []string{"Bearer {access-token}"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("GET", "https://secure.tap2pay.me/api/billing_agreements/{id}", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
GET /billing_agreements/{id}
Get billing agreement
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
id | path | string | true | ID of billing agreement to fetch |
Example responses
200 Response
{
"id": "string",
"state": "pending",
"payment_source": {
"type": "string",
"display_name": "string"
},
"customer": {
"id": "string",
"email": "string",
"first_name": "string",
"last_name": "string",
"phone": "string"
}
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | Billing agreement | BillingAgreement |
Schemas
Errors
{
"errors": [
"string"
]
}
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
errors | [string] | false | none | none |
NewInvoice
{
"invoice": {
"description": "string",
"gateway_name": "string",
"custom": "string",
"billing_agreement": {
"title": "string",
"description": "string"
},
"items": [
{
"name": "string",
"description": "string",
"product_id": "string",
"quantity": 0,
"price_value": 0,
"price_currency": "string"
}
]
}
}
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
invoice | object | true | none | none |
» description | string | false | none | none |
» gateway_name | string | false | none | Link invoice to custom gateway, if omitted default one will be used. |
» custom | string | false | none | Custom field, max length - 255 |
» billing_agreement | object | false | none | New associated billing agreement. This agreement will be activated after successful payment when stored payment method associated. |
»» title | string | true | none | none |
»» description | string | false | none | none |
» items | [any] | true | none | none |
»» name | string | true | none | none |
»» description | string | false | none | none |
»» product_id | string | false | none | ID of associated Product |
»» quantity | integer | false | none | none |
»» price_value | integer | true | none | none |
»» price_currency | string | false | none | none |
Invoice
{
"id": "string",
"status": "created",
"amount": "string",
"amount_value": 0,
"amount_currency": "string",
"billing_agreement_id": "string",
"description": "string",
"custom": "string",
"created_at": 0,
"telegram_start_link": "string",
"facebook_start_link": "string",
"viber_start_link": "string",
"web_checkout_link": "string",
"successful_payment_id": "string",
"items": [
{
"name": "string",
"product_id": "string",
"description": "string",
"quantity": 0,
"price_value": 0,
"price_currency": "string"
}
]
}
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
id | string | true | none | none |
status | string | true | none | Current status on invoice. One of [created, pending, succeeded, canceled] |
amount | string | true | none | Formatted total amount of the invoice |
amount_value | integer | true | none | A positive integer in the smallest currency unit (that is, 100 cents for $1.00, or 1 for ¥1, Japanese Yen being a 0-decimal currency) representing the total amount for the invoice. |
amount_currency | string | true | none | 3-letter ISO code representing the currency in which the invoice was made. |
billing_agreement_id | string | false | none | Id of associated billing agreement |
description | string | false | none | none |
custom | string | false | none | none |
created_at | integer | false | none | The timestamp at which the invoice was created |
telegram_start_link | string(uriref) | false | none | Direct link to telegram bot with invoice. |
facebook_start_link | string(uriref) | false | none | Direct link to facebook bot with invoice. |
viber_start_link | string(uriref) | false | none | Direct link to viber bot with invoice. |
web_checkout_link | string(uriref) | false | none | Link to web checkout page with invoice. |
successful_payment_id | string | false | none | Id of payment, which was paid invoice. You may get details using getPayment operation. |
items | [any] | false | none | none |
» name | string | false | none | none |
» product_id | string | false | none | ID of associated Product |
» description | string | false | none | none |
» quantity | integer | false | none | none |
» price_value | integer | false | none | none |
» price_currency | string | false | none | none |
Enumerated Values
Property | Value |
---|---|
status | created |
status | pending |
status | succeeded |
status | canceled |
Invoices
{
"current_page": 0,
"total_pages": 0,
"total_count": 0,
"items": [
{
"id": "string",
"status": "created",
"amount": "string",
"amount_value": 0,
"amount_currency": "string",
"billing_agreement_id": "string",
"description": "string",
"custom": "string",
"created_at": 0,
"telegram_start_link": "string",
"facebook_start_link": "string",
"viber_start_link": "string",
"web_checkout_link": "string",
"successful_payment_id": "string",
"items": [
{
"name": "string",
"product_id": "string",
"description": "string",
"quantity": 0,
"price_value": 0,
"price_currency": "string"
}
]
}
]
}
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
current_page | integer | true | none | none |
total_pages | integer | true | none | none |
total_count | integer | true | none | none |
items | [Invoice] | true | none | none |
NewProduct
{
"product": {
"name": "string",
"description": "string",
"image_url": "http://example.com",
"custom_id": "string",
"price_value": 0,
"price_currency": "string",
"price_fields": [{"amount": 0, "currency": "string"}]
}
}
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
product | object | true | none | none |
» name | string | true | none | none |
» description | string | false | none | none |
» image_url | string(uri) | false | none | none |
» custom_id | string | false | none | custom metadata |
» price_value | integer | true | none | none |
» price_currency | string | false | none | none |
» price_fields | [PriceField] | false | none | none |
Product
{
"id": "string",
"price": "string",
"price_value": 0,
"price_currency": "string",
"description": "string",
"custom_id": "string",
"created_at": 0,
"telegram_start_link": "string",
"facebook_start_link": "string",
"viber_start_link": "string",
"web_checkout_link": "string",
"price_fields": [{"amount": 0, "currency": "string"}]
}
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
id | string | true | none | none |
price | string | true | none | Formatted total amount of the invoice |
price_value | integer | true | none | A positive integer in the smallest currency unit (that is, 100 cents for $1.00, or 1 for ¥1, Japanese Yen being a 0-decimal currency) representing the total amount for the invoice. |
price_currency | string | true | none | 3-letter ISO code representing the currency in which the invoice was made. |
description | string | true | none | none |
custom_id | string | true | none | none |
created_at | integer | false | none | The timestamp at which the product was created |
telegram_start_link | string(uriref) | true | none | Direct link to telegram bot with product. |
facebook_start_link | string(uriref) | true | none | Direct link to facebook bot with product. |
viber_start_link | string(uriref) | true | none | Direct link to viber bot with product. |
web_checkout_link | string(uriref) | true | none | Link to web checkout page with product. |
price_fields | [PriceField] | true | none | none |
Products
{
"current_page": 0,
"total_pages": 0,
"total_count": 0,
"items": [
{
"id": "string",
"price": "string",
"price_value": 0,
"price_currency": "string",
"description": "string",
"custom_id": "string",
"created_at": 0,
"telegram_start_link": "string",
"facebook_start_link": "string",
"viber_start_link": "string",
"web_checkout_link": "string",
"price_fields": [{"amount": 0, "currency": "string"}]
}
]
}
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
current_page | integer | true | none | none |
total_pages | integer | true | none | none |
total_count | integer | true | none | none |
items | [Product] | true | none | none |
NewSubscription
{
"subscription": {
"title": "string",
"image_url": "http://example.com",
"custom": "string",
"billing_cycle_term": "day",
"billing_cycle_frequency": 0,
"amount_value": 0,
"amount_currency": "string",
"first_amount_value": 0,
"first_amount_currency": "string"
}
}
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
subscription | object | true | none | none |
» title | string | false | none | none |
» image_url | string(uri) | false | none | none |
» custom | string | false | none | custom metadata |
» billing_cycle_term | string | true | none | Billing term unit. One of [day, week, month, year] |
» billing_cycle_frequency | integer | true | none | Count of billing_cycle_term |
» amount_value | integer | true | none | A positive integer in the smallest currency unit (that is, 100 cents for $1.00, or 1 for ¥1, Japanese Yen being a 0-decimal currency) representing the total recurring amount for the subscription. |
» amount_currency | string | true | none | 3-letter ISO code representing the currency in which the subscription was made. |
» first_amount_value | integer | false | none | A positive integer in the smallest currency unit (that is, 100 cents for $1.00, or 1 for ¥1, Japanese Yen being a 0-decimal currency) representing the amount for first payment of the subscription. |
» first_amount_currency | string | false | none | 3-letter ISO code representing the currency in which the subscription was made. |
Enumerated Values
Property | Value |
---|---|
billing_cycle_term | day |
billing_cycle_term | week |
billing_cycle_term | month |
billing_cycle_term | year |
Subscription
{
"title": "string",
"image_url": "http://example.com",
"custom": "string",
"billing_cycle_term": "day",
"billing_cycle_frequency": 0,
"amount_value": 0,
"amount_currency": "string",
"first_amount_value": 0,
"first_amount_currency": "string",
"id": "string",
"state": "created",
"amount": "string",
"paid_through": 0,
"created_at": 0,
"billing_cycle": "string",
"billing_agreement_id": "string",
"current_invoice": {
"id": "string",
"state": "string",
"created_at": 0,
"telegram_start_link": "http://example.com",
"facebook_start_link": "http://example.com",
"viber_start_link": "http://example.com",
"web_checkout_link": "http://example.com"
}
}
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
title | string | true | none | none |
image_url | string(uri) | false | none | none |
custom | string | true | none | custom metadata |
billing_cycle_term | string | true | none | Billing term unit. One of [day, week, month, year] |
billing_cycle_frequency | integer | true | none | Count of billing_cycle_term |
amount_value | integer | true | none | A positive integer in the smallest currency unit (that is, 100 cents for $1.00, or 1 for ¥1, Japanese Yen being a 0-decimal currency) representing the total recurring amount for the subscription. |
amount_currency | string | true | none | 3-letter ISO code representing the currency in which the subscription was made. |
first_amount_value | integer | false | none | A positive integer in the smallest currency unit (that is, 100 cents for $1.00, or 1 for ¥1, Japanese Yen being a 0-decimal currency) representing the amount for first payment of the subscription. |
first_amount_currency | string | false | none | 3-letter ISO code representing the currency in which the subscription was made. |
id | string | true | none | none |
state | string | true | none | Current state of subscription. One of [created, active, canceled, past_due, paused] |
amount | string | true | none | Formatted total amount of the subscription |
paid_through | integer | false | none | none |
created_at | integer | false | none | The timestamp at which the subscription was created |
billing_cycle | string | true | none | Human formatted billing cycle |
billing_agreement_id | string | false | none | none |
current_invoice | object | false | none | Current invoice associated with subscription |
» id | string | false | none | Invoice id |
» state | string | false | none | none |
» created_at | integer | false | none | none |
» telegram_start_link | string(uri) | false | none | none |
» facebook_start_link | string(uri) | false | none | none |
» viber_start_link | string(uri) | false | none | none |
» web_checkout_link | string(uri) | false | none | none |
Enumerated Values
Property | Value |
---|---|
billing_cycle_term | day |
billing_cycle_term | week |
billing_cycle_term | month |
billing_cycle_term | year |
state | created |
state | active |
state | canceled |
state | past_due |
state | paused |
Subscriptions
{
"current_page": 0,
"total_pages": 0,
"total_count": 0,
"items": [
{
"title": "string",
"image_url": "http://example.com",
"custom": "string",
"billing_cycle_term": "day",
"billing_cycle_frequency": 0,
"amount_value": 0,
"amount_currency": "string",
"first_amount_value": 0,
"first_amount_currency": "string",
"id": "string",
"state": "created",
"amount": "string",
"paid_through": 0,
"created_at": 0,
"billing_cycle": "string",
"billing_agreement_id": "string",
"current_invoice": {
"id": "string",
"state": "string",
"created_at": 0,
"telegram_start_link": "http://example.com",
"facebook_start_link": "http://example.com",
"viber_start_link": "http://example.com",
"web_checkout_link": "http://example.com"
}
}
]
}
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
current_page | integer | true | none | none |
total_pages | integer | true | none | none |
total_count | integer | true | none | none |
items | [Subscription] | true | none | none |
Payment
{
"id": "string",
"state": "pending",
"invoice_id": "string",
"billing_agreement_id": "string",
"merchant_transaction_id": "string"
}
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
id | string | false | none | none |
state | string | false | none | Current status of payment |
invoice_id | string | false | none | none |
billing_agreement_id | string | false | none | Id of associated billing id. Will be present if billing agreement activation requested or payment made via createPayment using existing billing agreement. |
merchant_transaction_id | string | false | none | Unique id of payment in merchant's system |
Enumerated Values
Property | Value |
---|---|
state | pending |
state | succeeded |
state | failed |
NewPayment
{
"payment": {
"invoice_id": "string",
"billing_agreement_id": "string",
"merchant_transaction_id": "string"
}
}
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
payment | object | true | none | none |
» invoice_id | string | true | none | none |
» billing_agreement_id | string | true | none | ID of billing agreement. Billing agreement must be in active state. To get activated billing agreement you must pass billing_agreement property to createInvoice operation and wait until user make payment. |
» merchant_transaction_id | string | false | none | Id of payment in merchant's system. It must be unique. If duplicate found, error will be returned and payment won't be created. |
PaymentSource
{
"type": "string",
"display_name": "string"
}
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
type | string | true | none | none |
display_name | string | true | none | none |
Customer
{
"id": "string",
"email": "string",
"first_name": "string",
"last_name": "string",
"phone": "string"
}
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
id | string | true | none | none |
string | true | none | none | |
first_name | string | false | none | none |
last_name | string | false | none | none |
phone | string | false | none | none |
BillingAgreement
{
"id": "string",
"state": "pending",
"payment_source": {
"type": "string",
"display_name": "string"
},
"customer": {
"id": "string",
"email": "string",
"first_name": "string",
"last_name": "string",
"phone": "string"
}
}
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
id | string | true | none | none |
state | string | true | none | Current status on agreement. |
payment_source | PaymentSource | false | none | none |
customer | Customer | false | none | none |
Enumerated Values
Property | Value |
---|---|
state | pending |
state | active |
state | inactive |
PriceField
{
"amount": 0,
"currency": "string"
}
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
amount | integer | true | none | A positive integer in the smallest currency unit (that is, 100 cents for $1.00, or 1 for ¥1, Japanese Yen being a 0-decimal currency) representing the additional total amount for the invoice. |
currency | string | true | none | 3-letter ISO code representing the currency. |
Webhooks
Use webhooks to be notified about events that happen in a your account.
Interacting with a third-party API like Tap2pay's can introduce two problems:
Services not directly responsible for making an API request may still need to know the response of that request
Some events, are not the result of a direct API request
Webhooks solve these problems by letting you register a URL that we will notify anytime an event happens in your account.
When the event occurs — for example, when a successful charge is made on a customer's invoice, Tap2pay creates an Event object.
This object contains all the relevant information about what just happened,
including the type of event and the data associated with that event.
Tap2pay then sends the Event object as application/json
to any URLs in your account's webhooks
settings via an HTTP POST request.
If webhook endpoint not returning a 200
status code Tap2pay will retry again with exponential backoff.
The two most common mistakes with webhooks are providing the wrong URL
in the dashboard and the webhook endpoint not returning a 200
status code.
Types of events
This is a list of all the types of events we currently send. We may add more at any time, so you shouldn't rely on only these types existing in your code.
invoice.pending - Occurs whenever a pending invoice is created. Describes Invoice
invoice.succeeded - Occurs whenever a invoice is paid. Describes Invoice
invoice.requested - Occurs whenever a invoice is requested. Describes Invoice
invoice.returned - Occurs whenever a invoice is returned. Describes Invoice
invoice.canceled - Occurs whenever a invoice is canceled. Describes Invoice
subscription.created - Occurs when subscription created. Describes Subscription
subscription.updated - Occurs when subscription updated via updateSubscription. Describes Subscription
subscription.pending_activation - Occurs when subscription pending activation after pause. Describes Subscription
subscription.active - Occurs when subscription activates. Describes Subscription
subscription.inactive - Occurs when subscription is inactive. Describes Subscription
subscription.paused - Occurs when subscription paused. Describes Subscription
subscription.canceled - Occurs when subscription cancels. Describes Subscription
subscription.past_due - Occurs when subscription past due. Describes Subscription
Webhook Event object
Example
{
"type":"invoice.succeeded",
"created_at":"2017-03-03T17:24:45.000+03:00",
"data":{
"id":"QZpipdvZ",
"status":"succeeded",
"description":"Invoice for subscription",
"paid_at":"2017-03-03T17:25:26.000+03:00",
"created_at":"2017-03-03T17:24:45.000+03:00",
"telegram_start_link":"https://telegram.me/Tap2pay?start=d0rwEr63-JK91qKoR11aug",
"facebook_start_link":"https://m.me/896890090422586?ref=d0rwEr63-JK91qKoR11aug",
"viber_uri":"viber://pa?chatURI=Tap2pay=d0rwEr63-JK91qKoR11aug",
"amount":"0.01 Br",
"amount_value":1,
"amount_currency":"BYN",
"custom":null,
"items":[
{
"product_id":"2jAsGCSK",
"price_value":1,
"price_currency":"BYN",
"name":"Test",
"quantity":1,
"image_url":"http://tap2pay.me/wp-content/uploads/2016/09/Tap2pay_Logo.svg",
"price":"$0.00"
}
],
"properties":{
"phone":"+37525123456789",
"company":"MetricsDevelopment",
"fullname":"Dmitry K"
},
"customer_email":"[email protected]"
}
}
Name | Type | Description |
---|---|---|
type | string | Description of the event: e.g. invoice.pending , invoice.succeeded , etc. |
created_at | integer | Timestamp of event |
data | object | Data associated with event |
Express Checkout Widget
Express Checkout Widget is the best payment flow, on web and mobile.
Our JS library was built with customization in mind. You can open payment widget through simple function call. This allows you to fully customize "Pay" button, or even open payment widget after form submission on your webpage. Use full power of JS for building customized payment flow.
Checkout product
Example
<script src='https://secure.tap2pay.me/checkout.v1.js'></script>
<script>
var t2pHandler = new T2P.Checkout({merchant_id: "<MERCHANT_ID>");
</script>
<button type="button" onClick="t2pHandler.openProduct('<PRODUCT_ID>')">Buy</button>
Function: openProduct(id, invoiceParams, widgetOptions)
Arguments:
Name | Type | Description | Example |
---|---|---|---|
id | string | Product id | 'asdqwe' |
invoiceParams | object | Invoice params | { custom: "123", enabled_gateways: ["default_test"] } |
widgetOptions | object | Options for widget | |
» enabledChats | Array | Chats buttons to show | ['facebook', 'viber', 'telegram'] |
Open widget with product, created through API or in dashboard.
New invoice checkout
Example
<script src='https://secure.tap2pay.me/checkout.v1.js'></script>
<script>
var t2pHandler = new T2P.Checkout({merchant_id: "<MERCHANT_ID>"});
var onClick = function() {
t2pHandler.open({
amount_currency: 'USD',
amount_value: 100000, // in cents
items: [
{
name: 'iPhone 7',
price_currency: 'USD',
price_value: 100000,
image_url: 'http://cdn2.gsmarena.com/vv/pics/apple/apple-iphone-7-1.jpg'
}
]
}, { enabledChats: ['facebook', 'viber', 'telegram'] });
return false;
};
</script>
<button type="button" onClick="return onClick()">Buy</button>
Function: open(invoiceParams, widgetOptions)
Arguments:
Name | Type | Description | Example |
---|---|---|---|
invoiceParams |
object | Invoice params | NewInvoice object |
widgetOptions |
object | Options for widget | |
» enabledChats |
Array | Chats buttons to show | ['facebook', 'viber', 'telegram'] |
Note: this is insecure method to charge customer due user may change js code in his browser. For more secure method see.
Existing invoice checkout
Example
<script src='https://secure.tap2pay.me/checkout.v1.js'></script>
<script>
var t2pHandler = new T2P.Checkout({merchant_id: "<MERCHANT_ID>"});
</script>
<button type="button" onClick="t2pHandler.openInvoice('<INVOICE_ID>', { enabledChats: ['facebook', 'viber', 'telegram'] })">Buy</button>
You need to create invoice using invoice api to get Invoice#id.
Function: openInvoice(id, widgetOptions)
Arguments:
Name | Type | Description | Example |
---|---|---|---|
id | string | Invoice id | 'asdqwe' |
widgetOptions | object | Options for widget | |
» enabledChats | Array | Chats buttons to show | ['facebook', 'viber', 'telegram'] |
Callbacks
Example
<script src='https://secure.tap2pay.me/checkout.v1.js'></script>
<script>
var t2pHandler = new T2P.Checkout({merchant_id: "<MERCHANT_ID>"});
t2pHandler.on('complete', function() {
window.location.href = '/success';
});
</script>
<button type="button" onClick="t2pHandler.openInvoice('<INVOICE_ID>')">Buy</button>
Your can associate customized code with some events in widget.
Available events:
Name | Description |
---|---|
chatOpened | customer clicked on in chat link |
complete | after successful payment (NOTE: this event won't send if payment was through the chat) |
close | widget popup closed |
Inline Checkout Widget
The Inline Checkout Widget allows you to include a payment widget in your form. You must pass email and card holder (if needed) to the widget via postMessage
Inline Checkout product
Example
<div>
<input type="text" id='email' placeholder="Email">
</div>
<div>
<input type="text" id='card_holder' placeholder='Card Holder'>
</div>
<div id="inline-widget"></div>
<script src="https://secure.tap2pay.me/inline_checkout.v1.js"></script>
<script>
var t2pInlineWidget = new T2P.CheckoutInline("#inline-widget", {merchant_id: "<MERCHANT_ID>"});
t2pInlineWidget.openProduct("<PRODUCT_ID>")
</script>
<button id="pay">Pay</button>
<script>
let button = document.getElementById('pay')
button.addEventListener('click', (e) => {
let data = {
type: 'card_fields',
params: {
email: document.getElementById('email').value,
card_holder: document.getElementById('card_holder').value
}
}
let frame = window.frames.t2p_inline_widget
frame.postMessage(JSON.stringify(data), '*')
})
</script>
Function: openProduct(id, invoiceParams)
Arguments:
Name | Type | Description | Example |
---|---|---|---|
id | string | Product id | 'asdqwe' |
invoiceParams | object | Invoice params | { custom: "123", enabled_gateways: ["default_test"] } |
Open widget with product, created through API or in dashboard.
New invoice inline checkout
Example
<div>
<input type="text"id='email' placeholder="Email">
</div>
<div>
<input type="text" id='card_holder' placeholder='Card Holder'>
</div>
<div id="inline-widget"></div>
<script src="https://secure.tap2pay.me/inline_checkout.v1.js"></script>
<script>
var t2pInlineWidget = new T2P.CheckoutInline("#inline-widget", {merchant_id: '<MERCHANT_ID>'});
t2pInlineWidget.open({
amount_currency: 'USD',
amount_value: 100000, // in cents
items: [
{
name: 'iPhone 7',
price_currency: 'USD',
price_value: 100000,
image_url: 'http://cdn2.gsmarena.com/vv/pics/apple/apple-iphone-7-1.jpg'
}
]
}
);
</script>
<button id="pay">Pay</button>
<script>
let button = document.getElementById('pay')
button.addEventListener('click', (e) => {
let data = {
type: 'card_fields',
params: {
email: document.getElementById('email').value,
card_holder: document.getElementById('card_holder').value
}
}
let frame = window.frames.t2p_inline_widget
frame.postMessage(JSON.stringify(data), '*')
})
</script>
Function: open(invoiceParams)
Arguments:
Name | Type | Description | Example |
---|---|---|---|
invoiceParams |
object | Invoice params | NewInvoice object |
Note: this is insecure method to charge customer due user may change js code in his browser. For more secure method see.
Existing invoice inline checkout
Example
<div>
<input type="text"id='email' placeholder="Email">
</div>
<div>
<input type="text" id='card_holder' placeholder='Card Holder'>
</div>
<div id="inline-widget"></div>
<script src="https://secure.tap2pay.me/inline_checkout.v1.js"></script>
<script>
var t2pInlineWidget = new T2P.CheckoutInline("#inline-widget", {merchant_id: '<MERCHANT_ID>'});
t2pInlineWidget.openInvoice('<INVOICE_ID>')
</script>
<button id="pay">Pay</button>
<script>
let button = document.getElementById('pay')
button.addEventListener('click', (e) => {
let data = {
type: 'card_fields',
params: {
email: document.getElementById('email').value,
card_holder: document.getElementById('card_holder').value
}
}
let frame = window.frames.t2p_inline_widget
frame.postMessage(JSON.stringify(data), '*')
})
</script>
You need to create invoice using invoice api to get Invoice#id.
Function: openInvoice(id)
Arguments:
Name | Type | Description | Example |
---|---|---|---|
id | string | Invoice id | 'asdqwe' |
Passing styles to inline widget
Example
<div>
<input type="text"id='email' placeholder="Email">
</div>
<div>
<input type="text" id='card_holder' placeholder='Card Holder'>
</div>
<div id="inline-widget"></div>
<script src="https://secure.tap2pay.me/inline_checkout.v1.js"></script>
<script>
var t2pInlineWidget = new T2P.CheckoutInline("#inline-widget", {merchant_id: '<MERCHANT_ID>'});
t2pInlineWidget.addStyles(
`body {
background-color: blue;
font-size: 15px;
}
.inline_gateway {
border: 4px solid red;
border-radius: 10px;
background-color: pink;
}
.accordion-item-body form input {
background-color: yellow
}
`
)
t2pInlineWidget.openProduct('<PRODUCT_ID>')
</script>
<button id="pay">Pay</button>
<script>
let button = document.getElementById('pay')
button.addEventListener('click', (e) => {
let data = {
type: 'card_fields',
params: {
email: document.getElementById('email').value,
card_holder: document.getElementById('card_holder').value
}
}
let frame = window.frames.t2p_inline_widget
frame.postMessage(JSON.stringify(data), '*')
})
</script>
The styles for your page may differ from the styles for the widget. You can pass new styles via postMessage to the widget
Function: addStyles(styles)
Arguments:
Name | Type | Description | Example |
---|---|---|---|
styles | string | Styles for widget | 'body {background-color: blue; }' |
Callbacks incline checkout
Example
<div>
<input type="text"id='email' placeholder="Email">
</div>
<div>
<input type="text" id='card_holder' placeholder='Card Holder'>
</div>
<div id="inline-widget"></div>
<script src="https://secure.tap2pay.me/inline_checkout.v1.js"></script>
<script>
var t2pInlineWidget = new T2P.CheckoutInline("#inline-widget", {merchant_id: '<MERCHANT_ID>'});
t2pInlineWidget.openProduct('<PRODUCT_ID>')
t2pInlineWidget.on('complete', function(e) {
window.location.href = '/success';
});
</script>
<button id="pay">Pay</button>
<script>
let button = document.getElementById('pay')
button.addEventListener('click', (e) => {
let data = {
type: 'card_fields',
params: {
email: document.getElementById('email').value,
card_holder: document.getElementById('card_holder').value
}
}
let frame = window.frames.t2p_inline_widget
frame.postMessage(JSON.stringify(data), '*')
})
</script>
Your can associate customized code with some events in widget.
Available events:
Name | Description |
---|---|
complete | after successful payment |
Guides
Preapproved payments
A Billing Agreement allows a merchant to charge customer when they purchase goods using already save payment method.
Billing Agreements are different from subscriptions. With subscriptions, a fixed amount is charged for a specified period, but with Billing Agreements, the amount and time period aren't fixed.
Setup Billing Agreement
1) Pass correct billing_agreement
property to createInvoice operation.
2) Save billing_agreement_id
from response.
3) Show user widget with created invoice.
4) Wait until user paid invoice. You may use webhooks or poll invoice status using getInvoice operation.
5) Check status of billing agreement using getBillingAgreement operation.
Billing agreement's status
will be active
if payment method successfully associated with billing agreement,
Make charge using activated billing agreement
To make charge using activated billing agreement you must pass billing_agreement_id
to createPayment operation.