Skip to content

Transfer to OTC

Transfer to OTC

Create, cancel, and check the status of an over-the-counter cash-pickup transfer.

resp, err := transfercredit.TransferToOTCCreatePayment(ctx, transport, hb, transfercredit.TransferToOTCCreatePaymentRequest{
	PartnerReferenceNo: "2020102900000000000001",
	CustomerNumber: "2020102900000000000001",
	OTP: "...",
	Amount: snap.Money{Value: "500000.00", Currency: "IDR"},
})
if err != nil {
	// errors.Is(err, snap.ErrBadRequest), snap.ErrUnauthorized, etc.
}

TransferToOTCCreatePayment

TransferToOTCCreatePayment calls the SNAP Transfer To OTC - Create Payment endpoint (Service Code 44, path …/{version}/emoney/otc-cashout, HTTP POST — no method override). hb must already carry every field snap.HeaderBuilder needs except Body, which TransferToOTCCreatePayment sets itself so the exact marshaled bytes are used for both signing and the wire body.

This operation is not idempotent and this package does not retry. Callers that retry a failed or timed-out call should reuse the same X-EXTERNAL-ID, since the server’s own duplicate-detection keys on it.

func TransferToOTCCreatePayment(ctx context.Context, t *snap.Transport, hb snap.HeaderBuilder, req TransferToOTCCreatePaymentRequest) (TransferToOTCCreatePaymentResponse, error)

Request — TransferToOTCCreatePaymentRequest

TransferToOTCCreatePaymentRequest is the request body for API Transfer To OTC - Create Payment (Service Code 44). PartnerReferenceNo, CustomerNumber, OTP, and Amount are mandatory per the Guides tab.

FieldTypePresence
partnerReferenceNostringMandatory
customerNumberstringMandatory
otpstringMandatory
amountsnap.MoneyMandatory
feeTypestringOptional

Response — TransferToOTCCreatePaymentResponse

TransferToOTCCreatePaymentResponse is the response body for API Transfer To OTC - Create Payment.

FieldTypePresence
responseCodestringMandatory
responseMessagestringMandatory
referenceNostringOptional
transactionDatestringOptional

TransferToOTCCancelPayment

TransferToOTCCancelPayment calls the SNAP Transfer To OTC - Cancel Payment endpoint (Service Code 46, HTTP POST). The standard’s own docs disagree on the exact path (.../emoney/otc-cancel vs .../otc/cashout/cancel) — this package makes no assumption either way and always uses the EndpointURL you supply in hb. It sets Body itself so the exact marshaled bytes are used for both signing and the wire body.

This operation is not idempotent and this package does not retry. Callers that retry a failed or timed-out call should reuse the same X-EXTERNAL-ID, since the server’s own duplicate-detection keys on it.

func TransferToOTCCancelPayment(ctx context.Context, t *snap.Transport, hb snap.HeaderBuilder, req TransferToOTCCancelPaymentRequest) (TransferToOTCCancelPaymentResponse, error)

Request — TransferToOTCCancelPaymentRequest

TransferToOTCCancelPaymentRequest is the request body for API Transfer To OTC - Cancel Payment (Service Code 46). OriginalPartnerReferenceNo, CustomerNumber, and Reason are mandatory per the Guides tab; OriginalReferenceNo is Conditional here (it flips to Mandatory in the response — see TransferToOTCCancelPaymentResponse’s doc comment).

FieldTypePresence
originalReferenceNostringOptional
originalPartnerReferenceNostringMandatory
originalExternalIdstringOptional
customerNumberstringMandatory
reasonstringMandatory

Response — TransferToOTCCancelPaymentResponse

TransferToOTCCancelPaymentResponse is the response body for API Transfer To OTC - Cancel Payment. OriginalReferenceNo is Mandatory here (it was Conditional on the request). CancelTime is Conditional — required only if the cancellation succeeded — so it’s modeled Optional.

FieldTypePresence
responseCodestringMandatory
responseMessagestringMandatory
originalReferenceNostringMandatory
cancelTimestringOptional
transactionDatestringOptional

TransferToOTCTransferStatus

TransferToOTCTransferStatus calls the SNAP Transfer To OTC - Transfer Status endpoint (Service Code 45, path …/{version}/emoney/otc-status, HTTP POST — no method override). hb must already carry every field snap.HeaderBuilder needs except Body, which TransferToOTCTransferStatus sets itself so the exact marshaled bytes are used for both signing and the wire body.

func TransferToOTCTransferStatus(ctx context.Context, t *snap.Transport, hb snap.HeaderBuilder, req TransferToOTCTransferStatusRequest) (TransferToOTCTransferStatusResponse, error)

Request — TransferToOTCTransferStatusRequest

TransferToOTCTransferStatusRequest is the request body for API Transfer To OTC - Transfer Status (Service Code 45). It follows the same shape as TransactionStatusInquiryBankRequest, plus CustomerNumber and a Mandatory (not Optional) Amount. ServiceCode and CustomerNumber are Mandatory.

FieldTypePresence
originalPartnerReferenceNostringOptional
originalReferenceNostringOptional
originalExternalIdstringOptional
serviceCodestringMandatory
transactionDatestringOptional
customerNumberstringMandatory
amountsnap.MoneyMandatory
additionalInfojson.RawMessageOptional

Response — TransferToOTCTransferStatusResponse

TransferToOTCTransferStatusResponse is the response body for API Transfer To OTC - Transfer Status — field-identical to TransactionStatusInquiryBankResponse, modeled as its own type since each SNAP service code gets a distinct type even when shapes match.

FieldTypePresence
responseCodestringMandatory
responseMessagestringMandatory
originalPartnerReferenceNostringOptional
originalReferenceNostringOptional
originalExternalIdstringOptional
serviceCodestringOptional
transactionDatestringOptional
amount*snap.MoneyOptional
beneficiaryAccountNostringMandatory
beneficiaryBankCodestringOptional
previousResponseCodestringOptional
referenceNumberstringMandatory
sourceAccountNostringMandatory
transactionIdstringOptional
latestTransactionStatusstringMandatory
transactionStatusDescstringOptional
additionalInfojson.RawMessageOptional