Send a receipt
Learn how to email receipts with the Dojo Payments API.
Dojo will automatically send an email receipt to a customer once they have successfully paid. The customer email is provided earlier, when creating the payment intent, inside the Customer schema object:
"customer": {
"emailAddress": "client@gmail.com",
"phoneNumber": "078654321"
}
Each payment has a receipt history which you can view in the Dojo for Business App.
Send additional emails
You can manually send additional receipts to customers. To do this use the endpoint below:
POST /payment-intents/{paymentIntentId}/receipt
In your request, include:
emails: the list of email addresses to which the receipt should be sent.
For the full specification, see the API reference.
Request example
The next example below shows how you would capture 10.00 GBP.
- cURL
- PowerShell
- Python
- C#
- PHP
# The sandbox API key passed in 'authorization' is public.
# Don't submit any personally identifiable information in any requests made with this key.
# Sign in to developer.dojo.tech to create your own private sandbox key and use that instead
# for secure testing.
curl -v --request POST \
--url https://api.dojo.tech/payment-intents/<paymentIntentId>/receipt \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic <your_api_key>' \
--header 'Version: 2024-02-05' \
--data '{
"emails": [
"gabriel@dojo.com",
"mari@dojo.com"
]
}'
# The sandbox API key passed in '$publicSandboxKey' is public.
# Don't submit any personally identifiable information in any requests made with this key.
# Sign in to developer.dojo.tech to create your own private sandbox key and use that instead
# for secure testing.
$publicSandboxKey = "sk_sandbox_c8oLGaI__msxsXbpBDpdtwJEz_eIhfQoKHmedqgZPCdBx59zpKZLSk8OPLT0cZolbeuYJSBvzDVVsYvtpo5RkQ"
# Replace <payment_intent_id> with ID of payment intent you want to send receipt for.
Invoke-WebRequest `
-Uri 'https://api.dojo.tech/payment-intents/<paymentIntentId>/receipt' `
-Method POST `
-Headers @{
"Version" = "2024-02-05"
"Authorization" = "Basic $publicSandboxKey"
}
-ContentType 'application/json' `
-Body '{
"emails": [
"gabriel@dojo.com",
"mari@dojo.com"
]
}'
# The sandbox API key passed in 'authorization' is public.
# Don't submit any personally identifiable information in any requests made with this key.
# Sign in to developer.dojo.tech to create your own private sandbox key and use that instead
# for secure testing.
import http.client
conn = http.client.HTTPSConnection("api.dojo.tech")
payload = "{\"emails\":[\"gabriel@dojo.com\",\"mari@dojo.com\"]}"
headers = {
'Content-Type': "application/json",
'Version': "2024-02-05",
'Authorization': "Basic <your_api_key>"
}
conn.request("POST", "/payment-intents/<paymentIntentId>/receipt", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
conn.close()
// The sandbox API key passed in 'ApiKeyClientAuthorization' is public.
// Don't submit any personally identifiable information in any requests made with this key.
// Sign in to developer.dojo.tech to create your own private sandbox key and use that instead
// for secure testing.
var receiptClient = new ReceiptClient(new HttpClient(), new ApiKeyClientAuthorization("<your_api_key>"));
receiptClient.CreateAsync("<paymentIntentId>", new SendEmailReceiptRequest{ Emails = new List<string>() { "my@email.com" }});
<?php
// The sandbox API key used in this example is public.
// Don't submit any personally identifiable information in any requests made with this key.
// Sign in to developer.dojo.tech to create your own private sandbox key and use that instead
// for secure testing.
namespace Test;
require_once "vendor/autoload.php";
use Dojo_PHP\ApiFactory;
use Dojo_PHP\Model\SendEmailReceiptRequest;
$apiKey = "<your_api_key>";
$api = ApiFactory::createPaymentIntentApi($apiKey);
$request = new SendEmailReceiptRequest(["emails" => ["gabriel@dojo.com", "mari@dojo.com"]]);
$api->receiptCreate(\Dojo_PHP\API_VERSION, "<paymentIntentId>", $request);
Response example
If your request is successful, the response will return an empty object.