Required Receipt Information
All required data for the payment receipt is
available right after the transaction is finished. You can also add this payment receipt
data to your already existing checkout receipt. For accessing it, the
transaction
variable in the
TransactionCompleted
callback provides the following two properties:
transaction.MerchantReceipt
transaction.CustomerReceipt
Make sure that your custom receipt contains all the following required fields and
that you are able to send receipts for successful refunds.
The receipt itself is
constructed from multiple
ReceiptLineItem
items. Each
item provides a
Label
that describes the entry itself,
and a
Value
containing the actual data. When building
the receipt on your end, do the following both for
transaction.MerchantReceipt
and
transaction.CustomerReceipt
:
Add all the merchant information, such as address including country, by
iterating over the
MerchantDetails
.
Specify the receipt type:
MerchantReceipt
or
CustomerReceipt
. For a receipt sent to the
merchant, it must clearly state
Merchant
Receipt
.
Provide the static elements that are available directly on the
Receipt
object, including:
Add all payment related information by iterating over the
PaymentDetails
.
And finally add all information from processing the transaction by iterating
over the
ClearingDetails
.
Check if you need to print Tip and Total Amount lines on the receipts via
TipLineRequired
.
Check if you need to print a signature line on the merchant receipt via
SignatureLineRequired
.
The receipts are already embedded in the transaction reference that you receive
after a successful transaction. The transaction object provides access to the
receipt for both, the merchant and the customer.
Receipts are only attached if the transaction did not fail, so always make sure to
check the transaction and both receipt properties before accessing them.
The fields in the customer and merchant receipts can be accessed in the following
way:
// Merchant Receipt
var receipt = transaction.MerchantReceipt;
Console.WriteLine("Merchant Receipt " + receipt.Type.Value);
// or Customer Receipt
// var receipt = transaction.CustomerReceipt;
// Console.WriteLine("Customer Receipt " + receipt.Type.Value));
Console.WriteLine("MERCHANT DETAILS:");
foreach (var merchantDetail in receipt.MerchantDetails)
{
Console.WriteLine("\t " + merchantDetail.Label + ": " + merchantDetail.Value);
}
Console.WriteLine("Amount: " + receipt.AmountAndCurrency.Value);
Console.WriteLine("Time: " + receipt.Time.Value);
Console.WriteLine("Date: " + receipt.Date.Value);
Console.WriteLine("Subject: " + receipt.Subject.Value);
Console.WriteLine("Status: " + receipt.StatusText.Value);
// -- Optional
Console.WriteLine("Transaction identifier: " + receipt.Identifier.Value);
// --
Console.WriteLine("PAYMENT DETAILS:");
foreach (var paymentDetail in receipt.PaymentDetails)
{
Console.WriteLine("\t " + paymentDetail.Label + ": " + paymentDetail.Value);
}
Console.WriteLine("CLEARING DETAILS:");
foreach (var clearingDetail in receipt.ClearingDetails)
{
Console.WriteLine("\t " + clearingDetail.Label + ": " + clearingDetail.Value);
}
if (receipt.TipLineRequired)
{
Console.WriteLine("TIP : ________________________");
Console.WriteLine("TOTAL: ________________________");
}
// Usually only on the Merchant Receipt
if(receipt.SignatureLineRequired)
{
Console.WriteLine("Customer Signature: ________________________");
}