-
Notifications
You must be signed in to change notification settings - Fork 12
Do capture, cancellation, and refund modifications
Igor Zhutaiev edited this page May 7, 2018
·
2 revisions
instance := adyen.New(
adyen.Testing,
os.Getenv("ADYEN_USERNAME"),
os.Getenv("ADYEN_PASSWORD"),
)
Please refer to this page for library configuration
API Docs: Capture: Adyen documentation
// amount should be multiplied by 100 for most of the currencies
// EUR is a default library currency (see link above)
request := adyen.Capture{
ModificationAmount: &adyen.Amount{Value: float32(1000), Currency: instance.Currency},
MerchantAccount: "MERCHANT_ACCOUNT", // Merchant Account setting
Reference: "YOUR_REFERENCE", // order number or some business reference
OriginalReference: "PSP_REFERENCE", // PSP reference that came as authorization results
}
response, err := instance.Modification().Capture(request)
if err != nil {
// handle error
}
// do something with a response
API Docs: Cancel: Adyen documentation
request := &adyen.Cancel{
Reference: "YOUR_REFERENCE", // order number or some business reference
MerchantAccount: "MERCHANT_ACCOUNT", // Merchant Account setting
OriginalReference: "PSP_REFERENCE", // PSP reference that came as authorization result
}
response, err := instance.Modification().Cancel(request)
if err != nil {
// handle error
}
// do something with a response
API Docs: Refund: Adyen documentation
// amount should be multiplied by 100 for most of the currencies
// EUR is a default library currency (see link above)
request := &adyen.Refund{
ModificationAmount: &adyen.Amount{Value: float32(1000), Currency: instance.Currency},
Reference: "YOUR_REFERENCE", // order number or some business reference
MerchantAccount: "MERCHANT_ACCOUNT", // Merchant Account setting
OriginalReference: "PSP_REFERENCE", // PSP reference that came as authorization result
}
response, err := instance.Modification().Refund(request)
if err != nil {
// handle error
}
// do something with a response