Receipts

United States

Send an order receipt to a user for their transactions. For more information, see Supported payment methods.

Prerequisites

Before you integrate with the Go SDK, complete the following:

Field descriptions

SendReceiptRequest

FieldRequiredTypeDescription
orderIdtrueStringClover-assigned universally unique identifier (UUID) for the order for which the receipt is to be sent.

Note: The orderID is different from PaymentId and is part of the order that is received as PayResponse for the PayRequest that was sent.

Length: 13 characters.
emailAddressfalseStringEmail address to which a receipt is to be sent. It can be null if the phone number is provided.
phoneNumberfalseStringPhone number to which receipt is to be sent via SMS. It can be null if an email address is provided

SendReceiptResponse

FieldTypeDescription
sendReceiptStatusStringIndicates whether a receipt was sent or not.

📘

NOTE

The refund transaction details appear on the receipts if the reversalRequest is sent for the payments.

Android

Request details

To send an order receipt, enter values in the PaymentReceiptDeliveryRequest request parameters.

The following are the response scenarios for the SendReceiptState:

  • Successful request returns OnSendReceiptComplete with ReceiptDeliveryResponse.
  • Failed request returns an error. For example, a validation error returns OnSendReceiptError.

Response details—SendReceiptState

FieldDescription
OnSendReceiptCompleteIndicates the receipt was sent successfully using the method mentioned under ReceiptDeliveryOption. See the ReceiptDeliveryResponse for details.
OnSendReceiptErrorIndicates the error occurred, and the receipt wasn't sent. See the CloverError types.

CloverError

The following are valid CloverError types:

TypeDescription
CloverSendReceiptErrorIndicates a validation error in SendReceipt. Example: INVALID_EMAIL_ADDRESS
CloverNetworkErrorIndicates the merchant status of a declined or pending status from the server.

SendReceipt request example

fun sendReceipt(request: SendReceiptRequest): Flow<SendReceiptState>
lifecycleScope.launch {
    val request = SendReceiptRequest(
        orderId = orderId,
        emailAddress = emailAddress,
        phoneNumber = phoneNumber
    )
 
    goSdk.sendReceipt(
        request
    ).collectLatest { sendReceiptState ->
 
        when (sendReceiptState) {
            is SendReceiptState.OnSendReceiptError -> {
                println("Receipt request failed: ${sendReceiptState.error}")
                updateUI(sendReceiptState)
            }
            is SendReceiptState.OnSendReceiptComplete -> {
                println("Receipt sent successfully: ${sendReceiptState.response}")
                updateUI(sendReceiptState)
            }
            else -> {
                //Something unexpected happened
            }
        }
    }
}

iOS

Enter an orderId followed by an email address or phone number.

Note: If both an email and a phone number are provided, a message is sent to both the phone and the email for validation.

To send an order receipt, enter values in the sendReceipt request parameters. See sendReceipt.

let sendReceiptRequest = SendReceiptRequest(orderId: orderId, emailAddress: emailTF?.text, phoneNumber: phoneTF.text)
 
do {
   try await CloverPaymentSDK.shared.sendReceipt(sendReceiptRequest)
   print("Receipt Sent")
} catch {
   print("Receipt Error: \(error)")
}