Share an enrolled card with a group as a payment method
curl --request POST \
--url https://api.sandbox.nevermined.app/api/v1/organizations/{orgId}/groups/{groupId}/payment-methods \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"paymentMethodId": "pm_1Abc2Def3Ghi4Jkl"
}
'import requests
url = "https://api.sandbox.nevermined.app/api/v1/organizations/{orgId}/groups/{groupId}/payment-methods"
payload = { "paymentMethodId": "pm_1Abc2Def3Ghi4Jkl" }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({paymentMethodId: 'pm_1Abc2Def3Ghi4Jkl'})
};
fetch('https://api.sandbox.nevermined.app/api/v1/organizations/{orgId}/groups/{groupId}/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.sandbox.nevermined.app/api/v1/organizations/{orgId}/groups/{groupId}/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([
'paymentMethodId' => 'pm_1Abc2Def3Ghi4Jkl'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$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.sandbox.nevermined.app/api/v1/organizations/{orgId}/groups/{groupId}/payment-methods"
payload := strings.NewReader("{\n \"paymentMethodId\": \"pm_1Abc2Def3Ghi4Jkl\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.sandbox.nevermined.app/api/v1/organizations/{orgId}/groups/{groupId}/payment-methods")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"paymentMethodId\": \"pm_1Abc2Def3Ghi4Jkl\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sandbox.nevermined.app/api/v1/organizations/{orgId}/groups/{groupId}/payment-methods")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"paymentMethodId\": \"pm_1Abc2Def3Ghi4Jkl\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"paymentMethod": {
"id": "3fa8…afa6",
"provider": "stripe",
"brand": "visa",
"last4": "4242",
"expMonth": 12,
"expYear": 2030,
"alias": "Team Amex",
"orgId": "org-3fa8…afa6"
}
}Groups & Budgets
Share an enrolled card with a group as a payment method
POST
/
organizations
/
{orgId}
/
groups
/
{groupId}
/
payment-methods
Share an enrolled card with a group as a payment method
curl --request POST \
--url https://api.sandbox.nevermined.app/api/v1/organizations/{orgId}/groups/{groupId}/payment-methods \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"paymentMethodId": "pm_1Abc2Def3Ghi4Jkl"
}
'import requests
url = "https://api.sandbox.nevermined.app/api/v1/organizations/{orgId}/groups/{groupId}/payment-methods"
payload = { "paymentMethodId": "pm_1Abc2Def3Ghi4Jkl" }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({paymentMethodId: 'pm_1Abc2Def3Ghi4Jkl'})
};
fetch('https://api.sandbox.nevermined.app/api/v1/organizations/{orgId}/groups/{groupId}/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.sandbox.nevermined.app/api/v1/organizations/{orgId}/groups/{groupId}/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([
'paymentMethodId' => 'pm_1Abc2Def3Ghi4Jkl'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$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.sandbox.nevermined.app/api/v1/organizations/{orgId}/groups/{groupId}/payment-methods"
payload := strings.NewReader("{\n \"paymentMethodId\": \"pm_1Abc2Def3Ghi4Jkl\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.sandbox.nevermined.app/api/v1/organizations/{orgId}/groups/{groupId}/payment-methods")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"paymentMethodId\": \"pm_1Abc2Def3Ghi4Jkl\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sandbox.nevermined.app/api/v1/organizations/{orgId}/groups/{groupId}/payment-methods")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"paymentMethodId\": \"pm_1Abc2Def3Ghi4Jkl\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"paymentMethod": {
"id": "3fa8…afa6",
"provider": "stripe",
"brand": "visa",
"last4": "4242",
"expMonth": 12,
"expYear": 2030,
"alias": "Team Amex",
"orgId": "org-3fa8…afa6"
}
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
application/json
Id of an org card to share with the group — the card's provider payment-method id (the same id the /payment-methods list, PATCH and revoke use), not the internal row id.
Example:
"pm_1Abc2Def3Ghi4Jkl"
Related topics
List a group's shared payment methodsGroups & BudgetsShare an org wallet with a group (so it funds the group budget)List the groups a wallet is shared withCard EnrollmentWas this page helpful?
⌘I