cURL
curl --request POST \
--url https://api.juo.io/customer/v1/payment-methods \
--header 'Content-Type: application/json' \
--header 'X-Delegated-Token: <api-key>' \
--header 'X-Tenant-ID: <x-tenant-id>' \
--data '
{
"returnUrl": "<string>"
}
'import requests
url = "https://api.juo.io/customer/v1/payment-methods"
payload = { "returnUrl": "<string>" }
headers = {
"X-Tenant-ID": "<x-tenant-id>",
"X-Delegated-Token": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'X-Tenant-ID': '<x-tenant-id>',
'X-Delegated-Token': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({returnUrl: '<string>'})
};
fetch('https://api.juo.io/customer/v1/payment-methods', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.juo.io/customer/v1/payment-methods",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'returnUrl' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-Delegated-Token: <api-key>",
"X-Tenant-ID: <x-tenant-id>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.juo.io/customer/v1/payment-methods"
payload := strings.NewReader("{\n \"returnUrl\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-Tenant-ID", "<x-tenant-id>")
req.Header.Add("X-Delegated-Token", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.juo.io/customer/v1/payment-methods")
.header("X-Tenant-ID", "<x-tenant-id>")
.header("X-Delegated-Token", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"returnUrl\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.juo.io/customer/v1/payment-methods")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-Tenant-ID"] = '<x-tenant-id>'
request["X-Delegated-Token"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"returnUrl\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"provider": "shopify",
"instrumentType": "credit-card",
"paymentMethod": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
},
"nextAction": {
"type": "email",
"email": "<string>"
},
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"customer": "<string>",
"instrument": {
"type": "credit-card",
"brand": "<string>",
"maskedNumber": "<string>",
"lastDigits": "<string>",
"expiryMonth": 123,
"expiryYear": 123,
"cardholderName": "<string>"
}
}{
"provider": "shopify",
"instrumentType": "credit-card",
"paymentMethod": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
},
"nextAction": {
"type": "email",
"email": "<string>"
}
}Payment methods
Create a payment method
Starts adding a payment method for the customer.
POST
/
payment-methods
cURL
curl --request POST \
--url https://api.juo.io/customer/v1/payment-methods \
--header 'Content-Type: application/json' \
--header 'X-Delegated-Token: <api-key>' \
--header 'X-Tenant-ID: <x-tenant-id>' \
--data '
{
"returnUrl": "<string>"
}
'import requests
url = "https://api.juo.io/customer/v1/payment-methods"
payload = { "returnUrl": "<string>" }
headers = {
"X-Tenant-ID": "<x-tenant-id>",
"X-Delegated-Token": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'X-Tenant-ID': '<x-tenant-id>',
'X-Delegated-Token': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({returnUrl: '<string>'})
};
fetch('https://api.juo.io/customer/v1/payment-methods', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.juo.io/customer/v1/payment-methods",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'returnUrl' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-Delegated-Token: <api-key>",
"X-Tenant-ID: <x-tenant-id>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.juo.io/customer/v1/payment-methods"
payload := strings.NewReader("{\n \"returnUrl\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-Tenant-ID", "<x-tenant-id>")
req.Header.Add("X-Delegated-Token", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.juo.io/customer/v1/payment-methods")
.header("X-Tenant-ID", "<x-tenant-id>")
.header("X-Delegated-Token", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"returnUrl\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.juo.io/customer/v1/payment-methods")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-Tenant-ID"] = '<x-tenant-id>'
request["X-Delegated-Token"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"returnUrl\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"provider": "shopify",
"instrumentType": "credit-card",
"paymentMethod": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
},
"nextAction": {
"type": "email",
"email": "<string>"
},
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"customer": "<string>",
"instrument": {
"type": "credit-card",
"brand": "<string>",
"maskedNumber": "<string>",
"lastDigits": "<string>",
"expiryMonth": 123,
"expiryYear": 123,
"cardholderName": "<string>"
}
}{
"provider": "shopify",
"instrumentType": "credit-card",
"paymentMethod": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
},
"nextAction": {
"type": "email",
"email": "<string>"
}
}This endpoint doesn’t accept payment details. It starts a flow the customer completes themselves, described by
The payment method can’t be used for billing until the customer completes the flow. It then appears in List payment methods.
The
nextAction in the response:
nextAction.type | Provider | Status | Customer action |
|---|---|---|---|
email | Shopify | 201 | Opens the link from the email and enters their card. |
redirect | Mollie | 202 | Sets up a SEPA Direct Debit mandate at nextAction.url, then returns to returnUrl. |
id, customer and instrument fields of the 201 response are deprecated. Use paymentMethod.id instead.Headers
Body
application/json
Response
Default Response