Attach a coupon to a Physical Card Order
const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({couponCode: 'DISCOUNT2023'})
};
fetch('https://api.gnosispay.com/api/v1/order/{orderId}/attach-coupon', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request POST \
--url https://api.gnosispay.com/api/v1/order/{orderId}/attach-coupon \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"couponCode": "DISCOUNT2023"
}
'import requests
url = "https://api.gnosispay.com/api/v1/order/{orderId}/attach-coupon"
payload = { "couponCode": "DISCOUNT2023" }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.gnosispay.com/api/v1/order/{orderId}/attach-coupon"
payload := strings.NewReader("{\n \"couponCode\": \"DISCOUNT2023\"\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.gnosispay.com/api/v1/order/{orderId}/attach-coupon")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"couponCode\": \"DISCOUNT2023\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.gnosispay.com/api/v1/order/{orderId}/attach-coupon")
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 \"couponCode\": \"DISCOUNT2023\"\n}"
response = http.request(request)
puts response.read_body{
"couponCode": "DISCOUNT2023"
}{
"message": "<string>"
}{
"message": "Card order not found."
}{
"message": "Coupon code is invalid."
}{
"message": "An unexpected error occurred."
}Physical Card Order
Attach a coupon to a Physical Card Order
This endpoint associates a provided coupon code with an existing card order by its orderId. Use the GPDOCS coupon code to get the card for free.
POST
/
api
/
v1
/
order
/
{orderId}
/
attach-coupon
Attach a coupon to a Physical Card Order
const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({couponCode: 'DISCOUNT2023'})
};
fetch('https://api.gnosispay.com/api/v1/order/{orderId}/attach-coupon', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request POST \
--url https://api.gnosispay.com/api/v1/order/{orderId}/attach-coupon \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"couponCode": "DISCOUNT2023"
}
'import requests
url = "https://api.gnosispay.com/api/v1/order/{orderId}/attach-coupon"
payload = { "couponCode": "DISCOUNT2023" }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.gnosispay.com/api/v1/order/{orderId}/attach-coupon"
payload := strings.NewReader("{\n \"couponCode\": \"DISCOUNT2023\"\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.gnosispay.com/api/v1/order/{orderId}/attach-coupon")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"couponCode\": \"DISCOUNT2023\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.gnosispay.com/api/v1/order/{orderId}/attach-coupon")
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 \"couponCode\": \"DISCOUNT2023\"\n}"
response = http.request(request)
puts response.read_body{
"couponCode": "DISCOUNT2023"
}{
"message": "<string>"
}{
"message": "Card order not found."
}{
"message": "Coupon code is invalid."
}{
"message": "An unexpected error occurred."
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
The unique identifier of the card order to which the coupon will be attached.
Body
application/json
The coupon code to be applied to the order.
Example:
"DISCOUNT2023"
Response
Coupon successfully attached to the card order.
The coupon code that was applied to the order.
Example:
"DISCOUNT2023"