curl --request POST \
--url https://{environment}.plugsurfing.com/drive/v1/users/{userId}/payment-options \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"paymentMethodId": "pm_1N9KPP2eZvKYlo2CY8E0x92p"
}
'import requests
url = "https://{environment}.plugsurfing.com/drive/v1/users/{userId}/payment-options"
payload = { "paymentMethodId": "pm_1N9KPP2eZvKYlo2CY8E0x92p" }
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({paymentMethodId: 'pm_1N9KPP2eZvKYlo2CY8E0x92p'})
};
fetch('https://{environment}.plugsurfing.com/drive/v1/users/{userId}/payment-options', 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://{environment}.plugsurfing.com/drive/v1/users/{userId}/payment-options",
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([
'paymentMethodId' => 'pm_1N9KPP2eZvKYlo2CY8E0x92p'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-Key: <api-key>"
],
]);
$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://{environment}.plugsurfing.com/drive/v1/users/{userId}/payment-options"
payload := strings.NewReader("{\n \"paymentMethodId\": \"pm_1N9KPP2eZvKYlo2CY8E0x92p\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-Key", "<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://{environment}.plugsurfing.com/drive/v1/users/{userId}/payment-options")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"paymentMethodId\": \"pm_1N9KPP2eZvKYlo2CY8E0x92p\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{environment}.plugsurfing.com/drive/v1/users/{userId}/payment-options")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"paymentMethodId\": \"pm_1N9KPP2eZvKYlo2CY8E0x92p\"\n}"
response = http.request(request)
puts response.read_body{
"id": "STRIPE-7844364278189399",
"paymentMethod": "CREDIT_CARD",
"brand": "visa",
"displayBrand": "visa",
"countryCode": "DE",
"expMonth": 12,
"expYear": 2025,
"last4": "1234"
}{
"message": "Invalid request payload",
"details": [
"field X is required"
]
}{
"message": "Resource not found"
}{
"message": "Resource not found"
}{
"message": "Resource not found"
}Add a new payment method
Adds a new payment method to a user’s account. Important notes: - A user can only have one payment method at a time.
curl --request POST \
--url https://{environment}.plugsurfing.com/drive/v1/users/{userId}/payment-options \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"paymentMethodId": "pm_1N9KPP2eZvKYlo2CY8E0x92p"
}
'import requests
url = "https://{environment}.plugsurfing.com/drive/v1/users/{userId}/payment-options"
payload = { "paymentMethodId": "pm_1N9KPP2eZvKYlo2CY8E0x92p" }
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({paymentMethodId: 'pm_1N9KPP2eZvKYlo2CY8E0x92p'})
};
fetch('https://{environment}.plugsurfing.com/drive/v1/users/{userId}/payment-options', 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://{environment}.plugsurfing.com/drive/v1/users/{userId}/payment-options",
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([
'paymentMethodId' => 'pm_1N9KPP2eZvKYlo2CY8E0x92p'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-Key: <api-key>"
],
]);
$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://{environment}.plugsurfing.com/drive/v1/users/{userId}/payment-options"
payload := strings.NewReader("{\n \"paymentMethodId\": \"pm_1N9KPP2eZvKYlo2CY8E0x92p\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-Key", "<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://{environment}.plugsurfing.com/drive/v1/users/{userId}/payment-options")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"paymentMethodId\": \"pm_1N9KPP2eZvKYlo2CY8E0x92p\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{environment}.plugsurfing.com/drive/v1/users/{userId}/payment-options")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"paymentMethodId\": \"pm_1N9KPP2eZvKYlo2CY8E0x92p\"\n}"
response = http.request(request)
puts response.read_body{
"id": "STRIPE-7844364278189399",
"paymentMethod": "CREDIT_CARD",
"brand": "visa",
"displayBrand": "visa",
"countryCode": "DE",
"expMonth": 12,
"expYear": 2025,
"last4": "1234"
}{
"message": "Invalid request payload",
"details": [
"field X is required"
]
}{
"message": "Resource not found"
}{
"message": "Resource not found"
}{
"message": "Resource not found"
}Authorizations
API key for authentication
Path Parameters
The unique identifier of the user to add the payment method for
Body
Stripe-specific payload to register a credit card payment method.
Stripe provided payment method id
"pm_321aSdF567gHij"
Response
Created
Stored credit card payment option details.
Unique identifier for this payment method in our system
"STRIPE-7844364278189399"
Payment method provider/type.
CREDIT_CARD "CREDIT_CARD"
Card network brand.
"visa"
ISO 3166-1 alpha-2
"DE"
Card expiration month (1-12).
12
Card expiration year (YYYY).
2025
Last four digits of the card number.
"1234"
The brand to use when displaying the card, this accounts for customer's brand choice on dual-branded cards. Stripe documentation: EU regulation: Co-badged cards compliance & Stripe PaymentMethod.card.display_brand
"visa"