Receipts
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:
- Create a global developer account with a default test merchant account.
- Create additional test merchants, if needed.
- Create an app in the sandbox.
- Create at least one employee role user for the OAuth flow.
- Order a Clover Go reader Developer Kit (Dev Kit) and set it up.
Field descriptions
SendReceiptRequest
Field | Required | Type | Description |
---|---|---|---|
orderId | true | String | Clover-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. |
emailAddress | false | String | Email address to which a receipt is to be sent. It can be null if the phone number is provided. |
phoneNumber | false | String | Phone number to which receipt is to be sent via SMS. It can be null if an email address is provided |
SendReceiptResponse
Field | Type | Description |
---|---|---|
sendReceiptStatus | String | Indicates 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
withReceiptDeliveryResponse
. - Failed request returns an error. For example, a validation error returns
OnSendReceiptError
.
Response details—SendReceiptState
Field | Description |
---|---|
OnSendReceiptComplete | Indicates the receipt was sent successfully using the method mentioned under ReceiptDeliveryOption. See the ReceiptDeliveryResponse for details. |
OnSendReceiptError | Indicates the error occurred, and the receipt wasn't sent. See the CloverError types. |
CloverError
The following are valid CloverError types:
Type | Description |
---|---|
CloverSendReceiptError | Indicates a validation error in SendReceipt. Example: INVALID_EMAIL_ADDRESS |
CloverNetworkError | Indicates 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)")
}
Updated 5 months ago