Skip to content

Auth Payment

Auth Payment

Card-style authorize/capture/void/refund flow: hold funds with AuthPayment, then capture, void, or refund; each write has a matching query call.

resp, err := transferdebit.AuthPayment(ctx, transport, hb, transferdebit.AuthPaymentRequest{
	PartnerReferenceNo: "2020102900000000000001",
	MerchantID: "...",
	Title: "...",
})
if err != nil {
	// errors.Is(err, snap.ErrBadRequest), snap.ErrUnauthorized, etc.
}

AuthPayment

AuthPayment calls the SNAP Auth Payment endpoint (Service Code 63, HTTP POST). It places a hold on funds without charging them. Pass hb with everything except Body already set — AuthPayment marshals the request itself and uses those exact bytes 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 AuthPayment(ctx context.Context, t *snap.Transport, hb snap.HeaderBuilder, req AuthPaymentRequest) (AuthPaymentResponse, error)

Request — AuthPaymentRequest

AuthPaymentRequest is the request body for Auth Payment. It places a hold on funds — Capture (65) later charges some or all of it, Void (67) releases what wasn’t captured.

items (a list of purchased goods) has no fixed schema in the standard, so it’s typed json.RawMessage — the same treatment as additionalInfo and every other field the standard leaves genuinely untyped.

FieldTypePresence
partnerReferenceNostringMandatory
merchantIdstringMandatory
subMerchantIdstringOptional
amount*snap.MoneyOptional
feeTypestringOptional
mccstringOptional
productCodestringOptional
titlestringMandatory
itemsjson.RawMessageOptional
additionalInfojson.RawMessageOptional

Response — AuthPaymentResponse

AuthPaymentResponse is the response body for Auth Payment. referenceNo is Conditional — present only on success.

FieldTypePresence
responseCodestringMandatory
responseMessagestringMandatory
referenceNostringOptional
partnerReferenceNostringOptional
amountsnap.MoneyMandatory
paidTimestringMandatory
additionalInfojson.RawMessageOptional

AuthPaymentQuery

AuthPaymentQuery calls the SNAP Payment Query endpoint (Service Code 64, HTTP POST) to check a previous Auth Payment’s status. Pass hb with everything except Body already set — AuthPaymentQuery marshals the request itself.

func AuthPaymentQuery(ctx context.Context, t *snap.Transport, hb snap.HeaderBuilder, req AuthPaymentQueryRequest) (AuthPaymentQueryResponse, error)

Request — AuthPaymentQueryRequest

AuthPaymentQueryRequest is the request body for Payment Query. No field is Mandatory — query by whichever reference, merchant, or store ID you have.

FieldTypePresence
originalPartnerReferenceNostringOptional
originalReferenceNostringOptional
merchantIdstringOptional
subMerchantIdstringOptional
externalStoreIdstringOptional
additionalInfojson.RawMessageOptional

Response — AuthPaymentQueryResponse

AuthPaymentQueryResponse is the response body for Payment Query. paidTime and latestTransactionStatus are Mandatory.

FieldTypePresence
responseCodestringMandatory
responseMessagestringMandatory
originalPartnerReferenceNostringOptional
originalReferenceNostringOptional
amount*snap.MoneyOptional
paidTimestringMandatory
latestTransactionStatusstringMandatory
transactionStatusDescstringOptional
additionalInfojson.RawMessageOptional

AuthCapture

AuthCapture calls the SNAP Capture endpoint (Service Code 65, HTTP POST). Pass hb with everything except Body already set — AuthCapture marshals the request itself.

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 AuthCapture(ctx context.Context, t *snap.Transport, hb snap.HeaderBuilder, req AuthCaptureRequest) (AuthCaptureResponse, error)

Request — AuthCaptureRequest

AuthCaptureRequest is the request body for Capture. It charges some or all of an amount held by Auth Payment (63) — call it multiple times for partial captures.

lastCapture is a string holding "true"/"false", not a real boolean — set it to mark the final capture in a partial-capture sequence.

FieldTypePresence
originalReferenceNostringMandatory
originalPartnerReferenceNostringMandatory
merchantIdstringMandatory
subMerchantIdstringOptional
partnerCaptureNostringMandatory
captureAmount*snap.MoneyOptional
titlestringMandatory
lastCapturestringOptional
additionalInfojson.RawMessageOptional

Response — AuthCaptureResponse

AuthCaptureResponse is the response body for Capture. captureNo and captureTime are Conditional — present only on success.

FieldTypePresence
responseCodestringMandatory
responseMessagestringMandatory
originalReferenceNostringOptional
originalPartnerReferenceNostringOptional
partnerCaptureNostringOptional
captureNostringOptional
captureAmountsnap.MoneyMandatory
captureTimestringOptional
additionalInfojson.RawMessageOptional

AuthCaptureQuery

AuthCaptureQuery calls the SNAP Capture Query endpoint (Service Code 66, HTTP POST) to check a previous Capture’s status. Pass hb with everything except Body already set — AuthCaptureQuery marshals the request itself.

func AuthCaptureQuery(ctx context.Context, t *snap.Transport, hb snap.HeaderBuilder, req AuthCaptureQueryRequest) (AuthCaptureQueryResponse, error)

Request — AuthCaptureQueryRequest

AuthCaptureQueryRequest is the request body for Capture Query (Service Code 66). originalReferenceNo, merchantId, and partnerCaptureNo are Mandatory.

FieldTypePresence
originalReferenceNostringMandatory
originalPartnerReferenceNostringOptional
merchantIdstringMandatory
subMerchantIdstringOptional
captureNostringOptional
partnerCaptureNostringMandatory
additionalInfojson.RawMessageOptional

Response — AuthCaptureQueryResponse

AuthCaptureQueryResponse is the response body for Capture Query. captureAmount and partnerCaptureNo are Mandatory here — unlike Capture’s own response, where partnerCaptureNo is Optional. latestCaptureStatus is one of INIT, SUCCESS, or FAILED.

FieldTypePresence
responseCodestringMandatory
responseMessagestringMandatory
originalReferenceNostringOptional
originalPartnerReferenceNostringOptional
captureNostringOptional
captureAmountsnap.MoneyMandatory
captureTimestringOptional
latestCaptureStatusstringOptional
partnerCaptureNostringMandatory
additionalInfojson.RawMessageOptional

AuthVoid

AuthVoid calls the SNAP Void endpoint (Service Code 67, HTTP POST). Pass hb with everything except Body already set — AuthVoid marshals the request itself.

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 AuthVoid(ctx context.Context, t *snap.Transport, hb snap.HeaderBuilder, req AuthVoidRequest) (AuthVoidResponse, error)

Request — AuthVoidRequest

AuthVoidRequest is the request body for Void. It releases funds a hold from Auth Payment (63) never captured.

voidRemainingAmount is a string holding "true"/"false", the same convention as Capture’s lastCapture.

FieldTypePresence
originalReferenceNostringMandatory
originalPartnerReferenceNostringMandatory
merchantIdstringMandatory
subMerchantIdstringOptional
voidAmount*snap.MoneyOptional
partnerVoidNostringMandatory
voidRemainingAmountstringOptional
reasonstringOptional
additionalInfojson.RawMessageOptional

Response — AuthVoidResponse

AuthVoidResponse is the response body for Void. voidNo and voidTime are Conditional — present only on success.

FieldTypePresence
responseCodestringMandatory
responseMessagestringMandatory
originalReferenceNostringOptional
originalPartnerReferenceNostringOptional
voidNostringOptional
partnerVoidNostringMandatory
voidAmountsnap.MoneyMandatory
voidTimestringOptional
additionalInfojson.RawMessageOptional

AuthVoidQuery

AuthVoidQuery calls the SNAP Void Query endpoint (Service Code 68, HTTP POST) to check a previous Void’s status. Pass hb with everything except Body already set — AuthVoidQuery marshals the request itself.

func AuthVoidQuery(ctx context.Context, t *snap.Transport, hb snap.HeaderBuilder, req AuthVoidQueryRequest) (AuthVoidQueryResponse, error)

Request — AuthVoidQueryRequest

AuthVoidQueryRequest is the request body for Void Query. originalReferenceNo, merchantId, and partnerVoidNo are Mandatory.

FieldTypePresence
originalReferenceNostringMandatory
originalPartnerReferenceNostringOptional
merchantIdstringMandatory
subMerchantIdstringOptional
voidNostringOptional
partnerVoidNostringMandatory
additionalInfojson.RawMessageOptional

Response — AuthVoidQueryResponse

AuthVoidQueryResponse is the response body for Void Query. voidAmount is Mandatory; partnerVoidNo is Optional here — unlike Void’s own response, where it’s Mandatory. latestVoidStatus is one of INIT, SUCCESS, or FAILED.

FieldTypePresence
responseCodestringMandatory
responseMessagestringMandatory
originalReferenceNostringOptional
originalPartnerReferenceNostringOptional
voidNostringOptional
voidAmountsnap.MoneyMandatory
voidTimestringOptional
latestVoidStatusstringOptional
partnerVoidNostringOptional
additionalInfojson.RawMessageOptional

AuthRefund

AuthRefund calls the SNAP Refund endpoint (Service Code 69, HTTP POST). Pass hb with everything except Body already set — AuthRefund marshals the request itself.

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 AuthRefund(ctx context.Context, t *snap.Transport, hb snap.HeaderBuilder, req AuthRefundRequest) (AuthRefundResponse, error)

Request — AuthRefundRequest

AuthRefundRequest is the request body for Refund. It reverses an amount already captured by Auth Capture (65).

originalCaptureNo is Conditional — unlike most Conditional fields in this package, it’s required when the original transaction failed, not when it succeeded.

FieldTypePresence
originalPartnerReferenceNostringMandatory
originalReferenceNostringOptional
partnerRefundNostringMandatory
merchantIdstringOptional
subMerchantIdstringOptional
originalCaptureNostringOptional
refundAmount*snap.MoneyOptional
externalStoreIdstringOptional
reasonstringOptional
additionalInfojson.RawMessageOptional

Response — AuthRefundResponse

AuthRefundResponse is the response body for Refund. refundNo and refundTime are Mandatory; partnerRefundNo is Optional.

originalCaptureNo and originalReferenceNo are both Conditional but on opposite triggers: originalCaptureNo appears when the transaction failed, originalReferenceNo when it succeeded.

FieldTypePresence
responseCodestringMandatory
responseMessagestringMandatory
originalCaptureNostringOptional
originalReferenceNostringOptional
originalPartnerReferenceNostringOptional
partnerRefundNostringOptional
refundNostringMandatory
refundAmount*snap.MoneyOptional
refundTimestringMandatory
additionalInfojson.RawMessageOptional