Skip to content

Transfer to Bank

Transfer to Bank

Inquiry and payment for a transfer routed to an external bank.

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

TransferToBankAccountInquiry

TransferToBankAccountInquiry calls the SNAP Transfer To Bank - Account Inquiry endpoint (Service Code 42, path …/{version}/emoney/bank-account-inquiry, HTTP POST — no method override). hb must already carry every field snap.HeaderBuilder needs except Body, which TransferToBankAccountInquiry sets itself so the exact marshaled bytes are used for both signing and the wire body.

func TransferToBankAccountInquiry(ctx context.Context, t *snap.Transport, hb snap.HeaderBuilder, req TransferToBankAccountInquiryRequest) (TransferToBankAccountInquiryResponse, error)

Request — TransferToBankAccountInquiryRequest

TransferToBankAccountInquiryRequest is the request body for API Transfer To Bank - Account Inquiry (Service Code 42). CustomerNumber and Amount are Mandatory. Note the wire field is CustomerNumber (capital C) here — every other endpoint uses lowercase customerNumber. Likely a documentation typo, but this package matches the documented casing exactly since no example confirms a fix.

FieldTypePresence
partnerReferenceNostringOptional
CustomerNumberstringMandatory
amountsnap.MoneyMandatory
beneficiaryAccountNumberstringOptional

Response — TransferToBankAccountInquiryResponse

TransferToBankAccountInquiryResponse is the response body for API Transfer To Bank - Account Inquiry.

FieldTypePresence
responseCodestringMandatory
responseMessagestringMandatory
accountTypestringOptional
beneficiaryAccountNumberstringMandatory
beneficiaryAccountNamestringMandatory
beneficiaryBankCodestringOptional
beneficiaryBankShortNamestringOptional
beneficiaryBankNamestringOptional
amountsnap.MoneyMandatory
sessionIdstringOptional

TransferToBankPayment

TransferToBankPayment calls the SNAP Transfer To Bank - Payment Transaction endpoint (Service Code 43, path …/{version}/emoney/transfer-bank, HTTP POST — no method override). hb must already carry every field snap.HeaderBuilder needs except Body, which TransferToBankPayment 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 TransferToBankPayment(ctx context.Context, t *snap.Transport, hb snap.HeaderBuilder, req TransferToBankPaymentRequest) (TransferToBankPaymentResponse, error)

Request — TransferToBankPaymentRequest

TransferToBankPaymentRequest is the request body for API Transfer To Bank - Payment Transaction (Service Code 43). PartnerReferenceNo, CustomerNumber, BeneficiaryAccountNumber, and Amount are Mandatory. Unlike Account Inquiry above, customerNumber here uses the normal lowercase casing.

FieldTypePresence
partnerReferenceNostringMandatory
customerNumberstringMandatory
accountTypestringOptional
beneficiaryAccountNumberstringMandatory
beneficiaryBankCodestringOptional
amountsnap.MoneyMandatory
sessionIdstringOptional
feeTypestringOptional

Response — TransferToBankPaymentResponse

TransferToBankPaymentResponse is the response body for API Transfer To Bank - Payment Transaction. Note referenceNo and referenceNumber are two separate fields, both present — not a duplicate.

FieldTypePresence
responseCodestringMandatory
responseMessagestringMandatory
referenceNostringOptional
transactionDatestringOptional
referenceNumberstringMandatory