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.
| Field | Type | Presence |
|---|---|---|
partnerReferenceNo | string | Optional |
CustomerNumber | string | Mandatory |
amount | snap.Money | Mandatory |
beneficiaryAccountNumber | string | Optional |
Response — TransferToBankAccountInquiryResponse
TransferToBankAccountInquiryResponse is the response body for API Transfer To Bank - Account Inquiry.
| Field | Type | Presence |
|---|---|---|
responseCode | string | Mandatory |
responseMessage | string | Mandatory |
accountType | string | Optional |
beneficiaryAccountNumber | string | Mandatory |
beneficiaryAccountName | string | Mandatory |
beneficiaryBankCode | string | Optional |
beneficiaryBankShortName | string | Optional |
beneficiaryBankName | string | Optional |
amount | snap.Money | Mandatory |
sessionId | string | Optional |
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.
| Field | Type | Presence |
|---|---|---|
partnerReferenceNo | string | Mandatory |
customerNumber | string | Mandatory |
accountType | string | Optional |
beneficiaryAccountNumber | string | Mandatory |
beneficiaryBankCode | string | Optional |
amount | snap.Money | Mandatory |
sessionId | string | Optional |
feeType | string | Optional |
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.
| Field | Type | Presence |
|---|---|---|
responseCode | string | Mandatory |
responseMessage | string | Mandatory |
referenceNo | string | Optional |
transactionDate | string | Optional |
referenceNumber | string | Mandatory |