Complete Purchase
https://bll.titan.email/partner/completePurchaseAPI to confirm payment for complete purchase of a Mail Order on the Titan Mail Cloud infra
API consumers can use Create Mail Order/Modify Mail Order APIs for order provisioning and upgrades/renewals.
This API serves a different (and more deeply integrated) case where partner is handling payments for some purchases user initiated in Titan's Domain Control Panel.
Flow:
- User initiates a payment action (adds some addon to cart, increases mailboxes, upgrades plan) on Control Panel.
- For payment Titan redirects user to a payment url partners provide, passing on a trackingId as part of jwt
- Partner takes payment from user and triggers this API (Complete Purchase) with the same trackingId
- Titan records the payment and makes the purchases associated with that trackingId.
Body
application/jsonThe unique order ID against each domain provisioned with Titan
[Deprecated] The mail order name associated to the Titan order ID
[Deprecated] unique id stored on your end for each customer
Payment tracking token fetched from Titan's control panel
This is the currency in which the customer is being charged for Titan mail. also updates domain to this currency
Total amount charged by the partner to the end customer in the customer's currency for this purchase including taxAmount. Precision upto 2 decimal places.
The value of chargedAmount in USD. If this field is null then open-exchange rates are used to calculate this field
Any ad hoc discount given to the customer for this purchase. This should be passed in the original currency in which amount was charged to the customers.
Amount collected from the user as TAX amount in the customer's currency for this purchase. Precision upto 2 decimal places.
Payment Transaction ID in your system.
Responses
200OKapplication/json
409ConflictRequest
- domain not in same state as during initiating purchase or no change applied on the domain.
PAYMENT_EXPIRED
- if trackingId has already been used to complete purchase.
/partner/completePurchase#include <curl/curl.h>
int main(void) {
curl_global_init(CURL_GLOBAL_DEFAULT);
CURL *curl = curl_easy_init();
if (!curl) {
curl_global_cleanup();
return 1;
}
curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(curl, CURLOPT_URL, "https://bll.titan.email/partner/completePurchase");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "Authorization: API.Key");
headers = curl_slist_append(headers, "Content-Type: application/json");
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(curl, CURLOPT_POSTFIELDS,
"{\n"
" \"titanOrderId\": 1,\n"
" \"domainName\": \"xyz.com\",\n"
" \"customerId\": \"abcd123\",\n"
" \"trackingId\": \"qwe-123-asd-321\",\n"
" \"currency\": \"USD\",\n"
" \"chargedAmount\": 12.2,\n"
" \"chargedUSDAmount\": 12.2,\n"
" \"discountAmount\": 1.5,\n"
" \"taxAmount\": 0.2,\n"
" \"paymentTxnId\": \"txnId\"\n"
"}");
CURLcode res = curl_easy_perform(curl);
curl_easy_cleanup(curl);
curl_slist_free_all(headers);
curl_global_cleanup();
return (int)res;
}using var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, "https://bll.titan.email/partner/completePurchase");
request.Headers.TryAddWithoutValidation("Authorization", "API.Key");
request.Content = new StringContent(
"""
{
"titanOrderId": 1,
"domainName": "xyz.com",
"customerId": "abcd123",
"trackingId": "qwe-123-asd-321",
"currency": "USD",
"chargedAmount": 12.2,
"chargedUSDAmount": 12.2,
"discountAmount": 1.5,
"taxAmount": 0.2,
"paymentTxnId": "txnId"
}
""",
System.Text.Encoding.UTF8, "application/json");
using var response = await client.SendAsync(request);var client = new RestClient("https://bll.titan.email/partner/completePurchase");
var request = new RestRequest("", Method.Post);
request.AddHeader("Authorization", "API.Key");
request.AddHeader("Content-Type", "application/json");
request.AddStringBody("""
{
"titanOrderId": 1,
"domainName": "xyz.com",
"customerId": "abcd123",
"trackingId": "qwe-123-asd-321",
"currency": "USD",
"chargedAmount": 12.2,
"chargedUSDAmount": 12.2,
"discountAmount": 1.5,
"taxAmount": 0.2,
"paymentTxnId": "txnId"
}
""", ContentType.Json);
var response = await client.ExecuteAsync(request);(require '[clj-http.client :as client])
(client/post "https://bll.titan.email/partner/completePurchase" {:headers {:Authorization "API.Key"}
:content-type :json
:form-params {:titanOrderId 1
:domainName "xyz.com"
:customerId "abcd123"
:trackingId "qwe-123-asd-321"
:currency "USD"
:chargedAmount 12.2
:chargedUSDAmount 12.2
:discountAmount 1.5
:taxAmount 0.2
:paymentTxnId "txnId"}})import 'package:http/http.dart' as http;
void main() async {
final headers = <String,String>{
'Authorization': 'API.Key',
'Content-Type': 'application/json',
};
final body = r'{"titanOrderId":1,"domainName":"xyz.com","customerId":"abcd123","trackingId":"qwe-123-asd-321","currency":"USD","chargedAmount":12.2,"chargedUSDAmount":12.2,"discountAmount":1.5,"taxAmount":0.2,"paymentTxnId":"txnId"}';
final response = await http.post(Uri.parse('https://bll.titan.email/partner/completePurchase'), headers: headers, body: body);
print(response.body);
}let httpRequestMessage = new HttpRequestMessage(
HttpMethod("POST"),
new Uri("https://bll.titan.email/partner/completePurchase")
)
httpRequestMessage.Headers.Add("Authorization", "API.Key")
httpRequestMessage.Headers.Add("Content-Type", "application/json")
let content = new StringContent("""{
"titanOrderId": 1,
"domainName": "xyz.com",
"customerId": "abcd123",
"trackingId": "qwe-123-asd-321",
"currency": "USD",
"chargedAmount": 12.2,
"chargedUSDAmount": 12.2,
"discountAmount": 1.5,
"taxAmount": 0.2,
"paymentTxnId": "txnId"
}""", Encoding.UTF8, "application/json")
httpRequestMessage.Content <- content
let client = new HttpClient()
let! result = client.SendAsync(httpRequestMessage)
package main
import (
"fmt"
"io"
"net/http"
"strings"
)
func main() {
requestUrl := "https://bll.titan.email/partner/completePurchase"
payload := strings.NewReader(`{
"titanOrderId": 1,
"domainName": "xyz.com",
"customerId": "abcd123",
"trackingId": "qwe-123-asd-321",
"currency": "USD",
"chargedAmount": 12.2,
"chargedUSDAmount": 12.2,
"discountAmount": 1.5,
"taxAmount": 0.2,
"paymentTxnId": "txnId"
}`)
req, _ := http.NewRequest("POST", requestUrl, payload)
req.Header.Add("Authorization", "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(res)
fmt.Println(string(body))
}POST /partner/completePurchase HTTP/1.1
Host: bll.titan.email
Authorization: API.Key
Content-Type: application/json
{"titanOrderId":1,"domainName":"xyz.com","customerId":"abcd123","trackingId":"qwe-123-asd-321","currency":"USD","chargedAmount":12.2,"chargedUSDAmount":12.2,"discountAmount":1.5,"taxAmount":0.2,"paymentTxnId":"txnId"}POST /bll/partner/completePurchase HTTP/1.1
Host: api-euc1.titan.email
Authorization: API.Key
Content-Type: application/json
{"titanOrderId":1,"domainName":"xyz.com","customerId":"abcd123","trackingId":"qwe-123-asd-321","currency":"USD","chargedAmount":12.2,"chargedUSDAmount":12.2,"discountAmount":1.5,"taxAmount":0.2,"paymentTxnId":"txnId"}java.io.ByteArrayOutputStream body = new java.io.ByteArrayOutputStream();
body.write("{\"titanOrderId\":1,\"domainName\":\"xyz.com\",\"customerId\":\"abcd123\",\"trackingId\":\"qwe-123-asd-321\",\"currency\":\"USD\",\"chargedAmount\":12.2,\"chargedUSDAmount\":12.2,\"discountAmount\":1.5,\"taxAmount\":0.2,\"paymentTxnId\":\"txnId\"}".getBytes(java.nio.charset.StandardCharsets.UTF_8));
try (AsyncHttpClient client = new DefaultAsyncHttpClient()) {
Response response = client.prepare("POST", "https://bll.titan.email/partner/completePurchase")
.addHeader("Authorization", "API.Key")
.addHeader("Content-Type", "application/json")
.setBody(body.toByteArray())
.execute()
.get();
System.out.println(response.getResponseBody());
}java.io.ByteArrayOutputStream body = new java.io.ByteArrayOutputStream();
body.write("{\"titanOrderId\":1,\"domainName\":\"xyz.com\",\"customerId\":\"abcd123\",\"trackingId\":\"qwe-123-asd-321\",\"currency\":\"USD\",\"chargedAmount\":12.2,\"chargedUSDAmount\":12.2,\"discountAmount\":1.5,\"taxAmount\":0.2,\"paymentTxnId\":\"txnId\"}".getBytes(java.nio.charset.StandardCharsets.UTF_8));
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(java.net.URI.create("https://bll.titan.email/partner/completePurchase"))
.header("Authorization", "API.Key")
.header("Content-Type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofByteArray(body.toByteArray()))
.build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());OkHttpClient client = new OkHttpClient();
RequestBody body = RequestBody.create(MediaType.parse("application/json"), "{\"titanOrderId\":1,\"domainName\":\"xyz.com\",\"customerId\":\"abcd123\",\"trackingId\":\"qwe-123-asd-321\",\"currency\":\"USD\",\"chargedAmount\":12.2,\"chargedUSDAmount\":12.2,\"discountAmount\":1.5,\"taxAmount\":0.2,\"paymentTxnId\":\"txnId\"}");
Request request = new Request.Builder()
.url("https://bll.titan.email/partner/completePurchase")
.method("POST", body)
.addHeader("Authorization", "API.Key")
.addHeader("Content-Type", "application/json")
.build();
try (Response response = client.newCall(request).execute()) {
System.out.println(response.body().string());
}java.io.ByteArrayOutputStream body = new java.io.ByteArrayOutputStream();
body.write("{\"titanOrderId\":1,\"domainName\":\"xyz.com\",\"customerId\":\"abcd123\",\"trackingId\":\"qwe-123-asd-321\",\"currency\":\"USD\",\"chargedAmount\":12.2,\"chargedUSDAmount\":12.2,\"discountAmount\":1.5,\"taxAmount\":0.2,\"paymentTxnId\":\"txnId\"}".getBytes(java.nio.charset.StandardCharsets.UTF_8));
HttpResponse<String> response = Unirest.request("POST", "https://bll.titan.email/partner/completePurchase")
.header("Authorization", "API.Key")
.header("Content-Type", "application/json")
.body(body.toByteArray())
.asString();
System.out.println(response.getBody());fetch('https://bll.titan.email/partner/completePurchase', {
method: 'POST',
headers: {
Authorization: 'API.Key',
'Content-Type': 'application/json'
},
body: JSON.stringify({
titanOrderId: 1,
domainName: 'xyz.com',
customerId: 'abcd123',
trackingId: 'qwe-123-asd-321',
currency: 'USD',
chargedAmount: 12.2,
chargedUSDAmount: 12.2,
discountAmount: 1.5,
taxAmount: 0.2,
paymentTxnId: 'txnId'
})
})import axios from 'axios'
const options = {
method: 'POST',
url: 'https://bll.titan.email/partner/completePurchase',
headers: {
Authorization: 'API.Key',
'Content-Type': 'application/json'
},
data: {
titanOrderId: 1,
domainName: 'xyz.com',
customerId: 'abcd123',
trackingId: 'qwe-123-asd-321',
currency: 'USD',
chargedAmount: 12.2,
chargedUSDAmount: 12.2,
discountAmount: 1.5,
taxAmount: 0.2,
paymentTxnId: 'txnId'
}
}
try {
const { data } = await axios.request(options)
console.log(data)
} catch (error) {
console.error(error)
}import { ofetch } from 'ofetch'
ofetch('https://bll.titan.email/partner/completePurchase', {
method: 'POST',
headers: {
Authorization: 'API.Key',
'Content-Type': 'application/json'
},
body: {
titanOrderId: 1,
domainName: 'xyz.com',
customerId: 'abcd123',
trackingId: 'qwe-123-asd-321',
currency: 'USD',
chargedAmount: 12.2,
chargedUSDAmount: 12.2,
discountAmount: 1.5,
taxAmount: 0.2,
paymentTxnId: 'txnId'
}
})$.ajax({
url: "https://bll.titan.email/partner/completePurchase",
method: "POST",
processData: false,
contentType: false,
beforeSend(xhr) {
xhr.setRequestHeader("Authorization", "API.Key");
xhr.setRequestHeader("Content-Type", "application/json");
},
data: "{\"titanOrderId\":1,\"domainName\":\"xyz.com\",\"customerId\":\"abcd123\",\"trackingId\":\"qwe-123-asd-321\",\"currency\":\"USD\",\"chargedAmount\":12.2,\"chargedUSDAmount\":12.2,\"discountAmount\":1.5,\"taxAmount\":0.2,\"paymentTxnId\":\"txnId\"}"
}).done((response) => console.log(response));const xhr = new XMLHttpRequest();
xhr.open("POST", "https://bll.titan.email/partner/completePurchase");
xhr.withCredentials = true;
xhr.setRequestHeader("Authorization", "API.Key");
xhr.setRequestHeader("Content-Type", "application/json");
xhr.addEventListener("load", () => console.log(xhr.responseText));
xhr.send("{\"titanOrderId\":1,\"domainName\":\"xyz.com\",\"customerId\":\"abcd123\",\"trackingId\":\"qwe-123-asd-321\",\"currency\":\"USD\",\"chargedAmount\":12.2,\"chargedUSDAmount\":12.2,\"discountAmount\":1.5,\"taxAmount\":0.2,\"paymentTxnId\":\"txnId\"}");using HTTP
using JSON
response = HTTP.post(
"https://bll.titan.email/partner/completePurchase",
[
"Authorization" => "API.Key",
"Content-Type" => "application/json"
],
JSON.json(Dict(
"titanOrderId" => 1,
"domainName" => "xyz.com",
"customerId" => "abcd123",
"trackingId" => "qwe-123-asd-321",
"currency" => "USD",
"chargedAmount" => 12.2,
"chargedUSDAmount" => 12.2,
"discountAmount" => 1.5,
"taxAmount" => 0.2,
"paymentTxnId" => "txnId"
))
)
println(String(response.body))val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\"titanOrderId\":1,\"domainName\":\"xyz.com\",\"customerId\":\"abcd123\",\"trackingId\":\"qwe-123-asd-321\",\"currency\":\"USD\",\"chargedAmount\":12.2,\"chargedUSDAmount\":12.2,\"discountAmount\":1.5,\"taxAmount\":0.2,\"paymentTxnId\":\"txnId\"}")
val request = Request.Builder()
.url("https://bll.titan.email/partner/completePurchase")
.post(body)
.addHeader("Authorization", "API.Key")
.addHeader("Content-Type", "application/json")
.build()
val response = client.newCall(request).execute()fetch('https://bll.titan.email/partner/completePurchase', {
method: 'POST',
headers: {
Authorization: 'API.Key',
'Content-Type': 'application/json'
},
body: JSON.stringify({
titanOrderId: 1,
domainName: 'xyz.com',
customerId: 'abcd123',
trackingId: 'qwe-123-asd-321',
currency: 'USD',
chargedAmount: 12.2,
chargedUSDAmount: 12.2,
discountAmount: 1.5,
taxAmount: 0.2,
paymentTxnId: 'txnId'
})
})import axios from 'axios'
const options = {
method: 'POST',
url: 'https://bll.titan.email/partner/completePurchase',
headers: {
Authorization: 'API.Key',
'Content-Type': 'application/json'
},
data: {
titanOrderId: 1,
domainName: 'xyz.com',
customerId: 'abcd123',
trackingId: 'qwe-123-asd-321',
currency: 'USD',
chargedAmount: 12.2,
chargedUSDAmount: 12.2,
discountAmount: 1.5,
taxAmount: 0.2,
paymentTxnId: 'txnId'
}
}
try {
const { data } = await axios.request(options)
console.log(data)
} catch (error) {
console.error(error)
}import { ofetch } from 'ofetch'
ofetch('https://bll.titan.email/partner/completePurchase', {
method: 'POST',
headers: {
Authorization: 'API.Key',
'Content-Type': 'application/json'
},
body: {
titanOrderId: 1,
domainName: 'xyz.com',
customerId: 'abcd123',
trackingId: 'qwe-123-asd-321',
currency: 'USD',
chargedAmount: 12.2,
chargedUSDAmount: 12.2,
discountAmount: 1.5,
taxAmount: 0.2,
paymentTxnId: 'txnId'
}
})import { request } from 'undici'
const { statusCode, body } = await request('https://bll.titan.email/partner/completePurchase', {
method: 'POST',
headers: {
Authorization: 'API.Key',
'Content-Type': 'application/json'
},
body: JSON.stringify({
titanOrderId: 1,
domainName: 'xyz.com',
customerId: 'abcd123',
trackingId: 'qwe-123-asd-321',
currency: 'USD',
chargedAmount: 12.2,
chargedUSDAmount: 12.2,
discountAmount: 1.5,
taxAmount: 0.2,
paymentTxnId: 'txnId'
})
})#import <Foundation/Foundation.h>
NSDictionary *headers = @{ @"Authorization": @"API.Key",
@"Content-Type": @"application/json" };
NSDictionary *parameters = @{ @"titanOrderId": @1,
@"domainName": @"xyz.com",
@"customerId": @"abcd123",
@"trackingId": @"qwe-123-asd-321",
@"currency": @"USD",
@"chargedAmount": @12.2,
@"chargedUSDAmount": @12.2,
@"discountAmount": @1.5,
@"taxAmount": @0.2,
@"paymentTxnId": @"txnId" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"https://bll.titan.email/partner/completePurchase"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];open Lwt.Infix
let () =
Lwt_main.run (
let uri = Uri.of_string "https://bll.titan.email/partner/completePurchase" in
let headers = Cohttp.Header.of_list [
("Authorization", "API.Key");
("Content-Type", "application/json");
] in
let part0 = "{\"titanOrderId\":1,\"domainName\":\"xyz.com\",\"customerId\":\"abcd123\",\"trackingId\":\"qwe-123-asd-321\",\"currency\":\"USD\",\"chargedAmount\":12.2,\"chargedUSDAmount\":12.2,\"discountAmount\":1.5,\"taxAmount\":0.2,\"paymentTxnId\":\"txnId\"}" in
let body = Cohttp_lwt.Body.of_string (String.concat "" [part0]) in
Cohttp_lwt_unix.Client.call ~headers ~body (Cohttp.Code.method_of_string "POST") uri
>>= fun (_response, body) ->
Cohttp_lwt.Body.to_string body >>= Lwt_io.printl
)$ch = curl_init("https://bll.titan.email/partner/completePurchase");
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: API.Key', 'Content-Type: application/json']);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([
'titanOrderId' => 1,
'domainName' => 'xyz.com',
'customerId' => 'abcd123',
'trackingId' => 'qwe-123-asd-321',
'currency' => 'USD',
'chargedAmount' => 12.2,
'chargedUSDAmount' => 12.2,
'discountAmount' => 1.5,
'taxAmount' => 0.2,
'paymentTxnId' => 'txnId'
]));
curl_exec($ch);
curl_close($ch);$client = new GuzzleHttp\Client();
$response = $client->request('POST', 'https://bll.titan.email/partner/completePurchase', [
'headers' => [
'Authorization' => 'API.Key',
'Content-Type' => 'application/json'
],
'json' => [
'titanOrderId' => 1,
'domainName' => 'xyz.com',
'customerId' => 'abcd123',
'trackingId' => 'qwe-123-asd-321',
'currency' => 'USD',
'chargedAmount' => 12.2,
'chargedUSDAmount' => 12.2,
'discountAmount' => 1.5,
'taxAmount' => 0.2,
'paymentTxnId' => 'txnId'
]
]);use Illuminate\Support\Facades\Http;
$response = Http::withHeaders([
'Authorization' => 'API.Key',
'Content-Type' => 'application/json'
])
->post('https://bll.titan.email/partner/completePurchase', [
'titanOrderId' => 1,
'domainName' => 'xyz.com',
'customerId' => 'abcd123',
'trackingId' => 'qwe-123-asd-321',
'currency' => 'USD',
'chargedAmount' => 12.2,
'chargedUSDAmount' => 12.2,
'discountAmount' => 1.5,
'taxAmount' => 0.2,
'paymentTxnId' => 'txnId'
]);$headers = @{
'Authorization' = 'API.Key'
'Content-Type' = 'application/json'
}
$body = [System.IO.MemoryStream]::new()
$bytes = [System.Text.Encoding]::UTF8.GetBytes('{"titanOrderId":1,"domainName":"xyz.com","customerId":"abcd123","trackingId":"qwe-123-asd-321","currency":"USD","chargedAmount":12.2,"chargedUSDAmount":12.2,"discountAmount":1.5,"taxAmount":0.2,"paymentTxnId":"txnId"}')
$body.Write($bytes, 0, $bytes.Length)
$response = Invoke-WebRequest -Uri 'https://bll.titan.email/partner/completePurchase' -Method 'POST' -Headers $headers -Body $body.ToArray()
$body.Dispose()
$response$headers = @{
'Authorization' = 'API.Key'
'Content-Type' = 'application/json'
}
$body = [System.IO.MemoryStream]::new()
$bytes = [System.Text.Encoding]::UTF8.GetBytes('{"titanOrderId":1,"domainName":"xyz.com","customerId":"abcd123","trackingId":"qwe-123-asd-321","currency":"USD","chargedAmount":12.2,"chargedUSDAmount":12.2,"discountAmount":1.5,"taxAmount":0.2,"paymentTxnId":"txnId"}')
$body.Write($bytes, 0, $bytes.Length)
$response = Invoke-RestMethod -Uri 'https://bll.titan.email/partner/completePurchase' -Method 'POST' -Headers $headers -Body $body.ToArray()
$body.Dispose()
$responseimport http.client
import json
conn = http.client.HTTPSConnection("bll.titan.email")
payload = json.dumps({
"titanOrderId": 1,
"domainName": "xyz.com",
"customerId": "abcd123",
"trackingId": "qwe-123-asd-321",
"currency": "USD",
"chargedAmount": 12.2,
"chargedUSDAmount": 12.2,
"discountAmount": 1.5,
"taxAmount": 0.2,
"paymentTxnId": "txnId"
})
headers = {
"Authorization": "API.Key",
"Content-Type": "application/json"
}
conn.request(
"POST",
"/partner/completePurchase",
body=payload,
headers=headers,
)
response = conn.getresponse()
print(response.read().decode())
conn.close()import http.client
import json
conn = http.client.HTTPSConnection("api-euc1.titan.email")
payload = json.dumps({
"titanOrderId": 1,
"domainName": "xyz.com",
"customerId": "abcd123",
"trackingId": "qwe-123-asd-321",
"currency": "USD",
"chargedAmount": 12.2,
"chargedUSDAmount": 12.2,
"discountAmount": 1.5,
"taxAmount": 0.2,
"paymentTxnId": "txnId"
})
headers = {
"Authorization": "API.Key",
"Content-Type": "application/json"
}
conn.request(
"POST",
"/bll/partner/completePurchase",
body=payload,
headers=headers,
)
response = conn.getresponse()
print(response.read().decode())
conn.close()requests.post(
"https://bll.titan.email/partner/completePurchase",
headers={
"Authorization": "API.Key",
"Content-Type": "application/json"
},
json={
"titanOrderId": 1,
"domainName": "xyz.com",
"customerId": "abcd123",
"trackingId": "qwe-123-asd-321",
"currency": "USD",
"chargedAmount": 12.2,
"chargedUSDAmount": 12.2,
"discountAmount": 1.5,
"taxAmount": 0.2,
"paymentTxnId": "txnId"
}
)async with aiohttp.ClientSession() as session:
await session.post(
"https://bll.titan.email/partner/completePurchase",
headers={
"Authorization": "API.Key",
"Content-Type": "application/json"
},
json={
"titanOrderId": 1,
"domainName": "xyz.com",
"customerId": "abcd123",
"trackingId": "qwe-123-asd-321",
"currency": "USD",
"chargedAmount": 12.2,
"chargedUSDAmount": 12.2,
"discountAmount": 1.5,
"taxAmount": 0.2,
"paymentTxnId": "txnId"
}
)httpx.post(
"https://bll.titan.email/partner/completePurchase",
headers={
"Authorization": "API.Key",
"Content-Type": "application/json"
},
json={
"titanOrderId": 1,
"domainName": "xyz.com",
"customerId": "abcd123",
"trackingId": "qwe-123-asd-321",
"currency": "USD",
"chargedAmount": 12.2,
"chargedUSDAmount": 12.2,
"discountAmount": 1.5,
"taxAmount": 0.2,
"paymentTxnId": "txnId"
}
)async with httpx.AsyncClient() as client:
await client.post(
"https://bll.titan.email/partner/completePurchase",
headers={
"Authorization": "API.Key",
"Content-Type": "application/json"
},
json={
"titanOrderId": 1,
"domainName": "xyz.com",
"customerId": "abcd123",
"trackingId": "qwe-123-asd-321",
"currency": "USD",
"chargedAmount": 12.2,
"chargedUSDAmount": 12.2,
"discountAmount": 1.5,
"taxAmount": 0.2,
"paymentTxnId": "txnId"
}
)library(httr2)
response <- request("https://bll.titan.email/partner/completePurchase") |>
req_method("POST") |>
req_headers(
"Authorization" = "API.Key",
"Content-Type" = "application/json"
) |>
req_body_json(list(
titanOrderId = 1,
domainName = "xyz.com",
customerId = "abcd123",
trackingId = "qwe-123-asd-321",
currency = "USD",
chargedAmount = 12.2,
chargedUSDAmount = 12.2,
discountAmount = 1.5,
taxAmount = 0.2,
paymentTxnId = "txnId"
)) |>
req_perform()
resp_body_string(response)require 'uri'
require 'net/http'
url = URI("https://bll.titan.email/partner/completePurchase")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'API.Key'
request["Content-Type"] = 'application/json'
request.body = <<~JSON
{
"titanOrderId": 1,
"domainName": "xyz.com",
"customerId": "abcd123",
"trackingId": "qwe-123-asd-321",
"currency": "USD",
"chargedAmount": 12.2,
"chargedUSDAmount": 12.2,
"discountAmount": 1.5,
"taxAmount": 0.2,
"paymentTxnId": "txnId"
}
JSON
response = http.request(request)
puts response.read_bodylet client = reqwest::Client::new();
let request = client
.post("https://bll.titan.email/partner/completePurchase")
.header("Authorization", "API.Key")
.header("Content-Type", "application/json")
.json(&serde_json::json!({
"titanOrderId": 1,
"domainName": "xyz.com",
"customerId": "abcd123",
"trackingId": "qwe-123-asd-321",
"currency": "USD",
"chargedAmount": 12.2,
"chargedUSDAmount": 12.2,
"discountAmount": 1.5,
"taxAmount": 0.2,
"paymentTxnId": "txnId"
}));
let response = request.send().await?;curl https://bll.titan.email/partner/completePurchase \
--request POST \
--header 'Authorization: API.Key' \
--header 'Content-Type: application/json' \
--data '{
"titanOrderId": 1,
"domainName": "xyz.com",
"customerId": "abcd123",
"trackingId": "qwe-123-asd-321",
"currency": "USD",
"chargedAmount": 12.2,
"chargedUSDAmount": 12.2,
"discountAmount": 1.5,
"taxAmount": 0.2,
"paymentTxnId": "txnId"
}'wget --quiet \
--method POST \
--header 'Authorization: API.Key' \
--header 'Content-Type: application/json' \
--body-data '{
"titanOrderId": 1,
"domainName": "xyz.com",
"customerId": "abcd123",
"trackingId": "qwe-123-asd-321",
"currency": "USD",
"chargedAmount": 12.2,
"chargedUSDAmount": 12.2,
"discountAmount": 1.5,
"taxAmount": 0.2,
"paymentTxnId": "txnId"
}' \
--output-document \
- https://bll.titan.email/partner/completePurchasehttp --ignore-stdin 'POST' 'https://bll.titan.email/partner/completePurchase' \
'Authorization:API.Key' \
'Content-Type:application/json' \
--raw='{"titanOrderId":1,"domainName":"xyz.com","customerId":"abcd123","trackingId":"qwe-123-asd-321","currency":"USD","chargedAmount":12.2,"chargedUSDAmount":12.2,"discountAmount":1.5,"taxAmount":0.2,"paymentTxnId":"txnId"}'import Foundation
var request = URLRequest(url: URL(string: "https://bll.titan.email/partner/completePurchase")!)
request.httpMethod = "POST"
request.setValue("API.Key", forHTTPHeaderField: "Authorization")
request.setValue("application/json", forHTTPHeaderField: "Content-Type")
let jsonBody = #"""
{
"titanOrderId": 1,
"domainName": "xyz.com",
"customerId": "abcd123",
"trackingId": "qwe-123-asd-321",
"currency": "USD",
"chargedAmount": 12.2,
"chargedUSDAmount": 12.2,
"discountAmount": 1.5,
"taxAmount": 0.2,
"paymentTxnId": "txnId"
}
"""#
request.httpBody = jsonBody.data(using: .utf8)
let (data, response) = try await URLSession.shared.data(for: request)
guard let httpResponse = response as? HTTPURLResponse,
200..<300 ~= httpResponse.statusCode else {
throw URLError(.badServerResponse)
}
print(String(data: data, encoding: .utf8) ?? ""){
"reqID": "server.req.id"
}