ποΈPublic API Access
Public Routes
Using your Public Key
const axios = require('axios');
// Config
const API_KEY = 'YOUR_API_KEY';
const BASE_URL = 'https://pay-api.swapped.com';
const ENDPOINT = '/v1/orders';
// Payload
const payload = {
purchase: {
name: 'text',
description: 'text',
imageUrl: 'text',
price: 'text',
currency: 'USD'
},
metadata: {
externalId: 'text',
customerId: 'text',
customerCountry: 'text',
customerEmail: 'text',
redirectUrl: 'text'
}
};
// Headers
const headers = {
'X-API-Key': API_KEY,
'Content-Type': 'application/json',
'Accept': '*/*'
};
// Request
axios.post(`${BASE_URL}${ENDPOINT}`, payload, { headers })
.then(response => {
console.log('β
Success:', response.status);
console.log(response.data);
})
.catch(error => {
console.error(error);
});Last updated