> For a complete page index, fetch https://docs.transak.com/llms.txt # Create Order (with Saved Card) POST https://api-gateway-stg.transak.com/api/v2/orders Content-Type: application/json The **Create Order (with Saved Card)** is an **authenticated API** that places a **crypto buy order** using a previously saved credit/debit card, based on the user's reserved wallet address and quote ID. Reference: https://docs.transak.com/api/whitelabel/payments/headless-cards/create-order-with-saved-card ## Request ### Headers - `x-user-ip` (string, required) — End user's originating IP. More details [here](/guides/mandatory-security-changes#user-ip-header-in-apis) - `x-api-key` (string, required) — Your Partner API key. You can find this in the [Partner Dashboard](https://docs.transak.com/guides/how-to-create-partner-dashboard-account#open-the-developers-section). - `authorization` (string, optional) — Authorization token is the accessToken received from the API -` api/v2/auth/verify` Note: This is not applicable for [Auth Reliance Flows](/features/auth-reliance) - `x-access-token` (string, optional) — Your Partner Access Token. Please refer [here](/guides/how-to-create-partner-access-token) for a tutorial on generating your access token. Note: This is applicable only for [Auth Reliance Flows](/features/auth-reliance) - `x-user-identifier` (string, optional) — The authenticated user's email address. Note: This is applicable only for [Auth Reliance Flows](/features/auth-reliance). ### Body (application/json) This endpoint expects an object. - `quoteId` (string, required) — Quote ID from the [Quotes API](/api/whitelabel/lookup/get-quote). - `paymentInstrumentId` (string, required) — Always `credit_debit_card` for placing an order with a saved card. - `walletAddress` (string, required) — Destination crypto wallet address. - `paymentIdentifierId` (string, required) — Identifier of the saved card, returned as `paymentIdentifierId` by the [Get Saved Cards API](/api/whitelabel/payments/headless-cards/get-saved-cards). - `additionalData` (ApiV2OrdersPostRequestBodyContentApplicationJsonSchemaAdditionalData, required) — The destination URLs for redirecting the user after payment success or failure. ## Response ### 200 Success - `data` (OrderCreatedResponseData, required) — Order details returned after processing the card transaction session. ## Errors ### 400 Bad Request Error Bad Request - `error` (ApiErrorBodyError, required) ### 401 Unauthorized Error Unauthorized - `error` (ApiErrorBodyError, required) ### 422 Unprocessable Entity Error Unprocessable Entity - `error` (ApiErrorBodyError, required) ### 500 Internal Server Error Internal Server Error - `error` (ApiErrorBodyError, required) ## Types ### ApiV2OrdersPostRequestBodyContentApplicationJsonSchemaAdditionalData The destination URLs for redirecting the user after payment success or failure. - `successUrl` (string, required) — Redirect URL on payment success. - `failureUrl` (string, required) — Redirect URL on payment failure. ### OrderCreatedResponseData Order details returned after processing the card transaction session. - `orderId` (string, required) — Unique identifier for the created order. - `status` (string, required) — Current order status (e.g. AWAITING_PAYMENT_FROM_USER). - `isBuyOrSell` (string, required) — Indicates whether the order is a BUY or SELL. - `fiatCurrency` (string, required) — Fiat currency used for the order. - `cryptoCurrency` (string, required) — Crypto asset being purchased. - `paymentMethod` (string, required) — Payment method used. Always `credit_debit_card` for this flow. - `network` (string, required) — Blockchain network for the crypto asset. - `fiatAmount` (double, required) — Fiat amount for the order. - `fiatAmountInUsd` (double, required) — Fiat amount converted to USD. - `cryptoAmount` (double, required) — Crypto amount the user will receive. - `paymentDetails` (list of OrderCreatedResponseDataPaymentDetailsItems, optional) - `partnerUserId` (string, optional) — Partner's user identifier associated with this order. - `networkId` (string, optional) — Chain ID of the network. - `walletAddress` (string, optional) — Destination wallet address for the crypto. - `quoteId` (string, optional) — Quote ID used to create this order. - `amountPaid` (double, optional) — Amount already paid by the user. - `conversionPrice` (double, optional) — Fiat-to-crypto conversion rate. - `totalFeeInFiat` (double, optional) — Total fee charged in fiat currency. - `txHash` (string, optional) — Blockchain transaction hash. Empty until the transaction is confirmed on-chain. - `walletLink` (string, optional) — Block explorer link for the wallet address. - `transactionLink` (string, optional) — Block explorer link for the transaction. - `addressAdditionalData` (OrderCreatedResponseDataAddressAdditionalData, optional) ### ApiErrorBodyError - `statusCode` (integer, required) - `message` (string, required) - `errorCode` (integer, optional) — Machine-readable error code for client handling. ### OrderCreatedResponseDataPaymentDetailsItems ### OrderCreatedResponseDataAddressAdditionalData - `name` (string, optional) - `displayName` (string, optional) - `value` (string, optional) - `requestId` (string, optional) ## Examples **Request** ```json { "quoteId": "", "paymentInstrumentId": "credit_debit_card", "walletAddress": "", "paymentIdentifierId": "", "additionalData": { "successUrl": "https://www.your_success_url.com", "failureUrl": "https://www.your_failure_url.com" } } ``` **Response** ```json { "data": { "orderId": "e8686c4e-52ee-449d-a3db-c79ffb6242b3", "status": "AWAITING_PAYMENT_FROM_USER", "isBuyOrSell": "BUY", "fiatCurrency": "GBP", "cryptoCurrency": "ETH", "paymentMethod": "credit_debit_card", "network": "ethereum", "fiatAmount": 26, "fiatAmountInUsd": 29.49, "cryptoAmount": 0.01550705, "paymentDetails": [ { "fiatCurrency": "GBP", "fields": [], "name": "Credit/Debit Card", "paymentMethod": "credit_debit_card", "redirectUrl": "https://authentication-devices.sandbox.checkout.com/sessions-interceptor/sid_jjtvtyqbig6izlwd754z67t2my" } ], "partnerUserId": "f76ed3a5-28b3-48dd-83fd-c4c3b2a9b894", "networkId": "", "walletAddress": "0x95ad61b0a150d79219dcf64e1e6cc01f0b64c4ce", "quoteId": "080ba0fd-af1a-43f7-8a13-94247f34d6c3", "amountPaid": 0, "conversionPrice": 0.0006278155874898677, "totalFeeInFiat": 1.3, "txHash": "", "walletLink": "https://sepolia.etherscan.io/address/0x95ad61b0a150d79219dcf64e1e6cc01f0b64c4ce", "transactionLink": "", "addressAdditionalData": { "name": "", "displayName": "", "value": "", "requestId": "" } } } ``` **SDK Code** ```python Success import requests url = "https://api-gateway-stg.transak.com/api/v2/orders" payload = { "quoteId": "", "paymentInstrumentId": "credit_debit_card", "walletAddress": "", "paymentIdentifierId": "", "additionalData": { "successUrl": "https://www.your_success_url.com", "failureUrl": "https://www.your_failure_url.com" } } headers = { "x-api-key": "", "x-user-ip": "", "Content-Type": "application/json" } response = requests.post(url, json=payload, headers=headers) print(response.json()) ``` ```javascript Success const url = 'https://api-gateway-stg.transak.com/api/v2/orders'; const options = { method: 'POST', headers: {'x-api-key': '', 'x-user-ip': '', 'Content-Type': 'application/json'}, body: '{"quoteId":"","paymentInstrumentId":"credit_debit_card","walletAddress":"","paymentIdentifierId":"","additionalData":{"successUrl":"https://www.your_success_url.com","failureUrl":"https://www.your_failure_url.com"}}' }; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` ```go Success package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api-gateway-stg.transak.com/api/v2/orders" payload := strings.NewReader("{\n \"quoteId\": \"\",\n \"paymentInstrumentId\": \"credit_debit_card\",\n \"walletAddress\": \"\",\n \"paymentIdentifierId\": \"\",\n \"additionalData\": {\n \"successUrl\": \"https://www.your_success_url.com\",\n \"failureUrl\": \"https://www.your_failure_url.com\"\n }\n}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("x-api-key", "") req.Header.Add("x-user-ip", "") req.Header.Add("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` ```ruby Success require 'uri' require 'net/http' url = URI("https://api-gateway-stg.transak.com/api/v2/orders") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request["x-api-key"] = '' request["x-user-ip"] = '' request["Content-Type"] = 'application/json' request.body = "{\n \"quoteId\": \"\",\n \"paymentInstrumentId\": \"credit_debit_card\",\n \"walletAddress\": \"\",\n \"paymentIdentifierId\": \"\",\n \"additionalData\": {\n \"successUrl\": \"https://www.your_success_url.com\",\n \"failureUrl\": \"https://www.your_failure_url.com\"\n }\n}" response = http.request(request) puts response.read_body ``` ```java Success import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.post("https://api-gateway-stg.transak.com/api/v2/orders") .header("x-api-key", "") .header("x-user-ip", "") .header("Content-Type", "application/json") .body("{\n \"quoteId\": \"\",\n \"paymentInstrumentId\": \"credit_debit_card\",\n \"walletAddress\": \"\",\n \"paymentIdentifierId\": \"\",\n \"additionalData\": {\n \"successUrl\": \"https://www.your_success_url.com\",\n \"failureUrl\": \"https://www.your_failure_url.com\"\n }\n}") .asString(); ``` ```php Success request('POST', 'https://api-gateway-stg.transak.com/api/v2/orders', [ 'body' => '{ "quoteId": "", "paymentInstrumentId": "credit_debit_card", "walletAddress": "", "paymentIdentifierId": "", "additionalData": { "successUrl": "https://www.your_success_url.com", "failureUrl": "https://www.your_failure_url.com" } }', 'headers' => [ 'Content-Type' => 'application/json', 'x-api-key' => '', 'x-user-ip' => '', ], ]); echo $response->getBody(); ``` ```csharp Success using RestSharp; var client = new RestClient("https://api-gateway-stg.transak.com/api/v2/orders"); var request = new RestRequest(Method.POST); request.AddHeader("x-api-key", ""); request.AddHeader("x-user-ip", ""); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{\n \"quoteId\": \"\",\n \"paymentInstrumentId\": \"credit_debit_card\",\n \"walletAddress\": \"\",\n \"paymentIdentifierId\": \"\",\n \"additionalData\": {\n \"successUrl\": \"https://www.your_success_url.com\",\n \"failureUrl\": \"https://www.your_failure_url.com\"\n }\n}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` ```swift Success import Foundation let headers = [ "x-api-key": "", "x-user-ip": "", "Content-Type": "application/json" ] let parameters = [ "quoteId": "", "paymentInstrumentId": "credit_debit_card", "walletAddress": "", "paymentIdentifierId": "", "additionalData": [ "successUrl": "https://www.your_success_url.com", "failureUrl": "https://www.your_failure_url.com" ] ] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://api-gateway-stg.transak.com/api/v2/orders")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "POST" request.allHTTPHeaderFields = headers request.httpBody = postData as Data let session = URLSession.shared let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in if (error != nil) { print(error as Any) } else { let httpResponse = response as? HTTPURLResponse print(httpResponse) } }) dataTask.resume() ```