Create a route for a specific payment. The routed amount is credited to the account of your customer.
package main
import(
"context"
"os"
"github.com/mollie/mollie-api-golang/models/components"
client "github.com/mollie/mollie-api-golang"
"log"
)
func main() {
ctx := context.Background()
s := client.New(
client.WithSecurity(components.Security{
APIKey: client.Pointer(os.Getenv("CLIENT_API_KEY")),
}),
)
res, err := s.DelayedRouting.Create(ctx, "tr_5B8cwPMGnU", client.Pointer("123e4567-e89b-12d3-a456-426"), &components.RouteCreateRequest{
Amount: components.Amount{
Currency: "EUR",
Value: "10.00",
},
Destination: components.RouteCreateRequestDestination{
Type: components.RouteDestinationTypeOrganization,
OrganizationID: "org_1234567",
},
Description: client.Pointer("Payment for Order #12345"),
})
if err != nil {
log.Fatal(err)
}
if res.RouteCreateResponse != nil {
// handle response
}
}| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. | |
paymentID |
string |
✔️ | Provide the ID of the related payment. | tr_5B8cwPMGnU |
idempotencyKey |
*string |
➖ | A unique key to ensure idempotent requests. This key should be a UUID v4 string. | 123e4567-e89b-12d3-a456-426 |
routeCreateRequest |
*components.RouteCreateRequest | ➖ | N/A | |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.PaymentCreateRouteResponse, error
| Error Type | Status Code | Content Type |
|---|---|---|
| apierrors.ErrorResponse | 404 | application/hal+json |
| apierrors.APIError | 4XX, 5XX | */* |
Retrieve a list of all routes created for a specific payment.
package main
import(
"context"
"os"
"github.com/mollie/mollie-api-golang/models/components"
client "github.com/mollie/mollie-api-golang"
"log"
)
func main() {
ctx := context.Background()
s := client.New(
client.WithTestmode(false),
client.WithSecurity(components.Security{
APIKey: client.Pointer(os.Getenv("CLIENT_API_KEY")),
}),
)
res, err := s.DelayedRouting.List(ctx, "tr_5B8cwPMGnU", client.Pointer("123e4567-e89b-12d3-a456-426"))
if err != nil {
log.Fatal(err)
}
if res.Object != nil {
// handle response
}
}| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. | |
paymentID |
string |
✔️ | Provide the ID of the related payment. | tr_5B8cwPMGnU |
testmode |
*bool |
➖ | Most API credentials are specifically created for either live mode or test mode. In those cases the testmode queryparameter must not be sent. For organization-level credentials such as OAuth access tokens, you can enable test mode by setting the testmode query parameter to true.Test entities cannot be retrieved when the endpoint is set to live mode, and vice versa. |
|
idempotencyKey |
*string |
➖ | A unique key to ensure idempotent requests. This key should be a UUID v4 string. | 123e4567-e89b-12d3-a456-426 |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.PaymentListRoutesResponse, error
| Error Type | Status Code | Content Type |
|---|---|---|
| apierrors.ErrorResponse | 404 | application/hal+json |
| apierrors.APIError | 4XX, 5XX | */* |
Retrieve a single route created for a specific payment.
package main
import(
"context"
"os"
"github.com/mollie/mollie-api-golang/models/components"
client "github.com/mollie/mollie-api-golang"
"log"
)
func main() {
ctx := context.Background()
s := client.New(
client.WithSecurity(components.Security{
APIKey: client.Pointer(os.Getenv("CLIENT_API_KEY")),
}),
)
res, err := s.DelayedRouting.Get(ctx, "tr_5B8cwPMGnU", "crt_dyARQ3JzCgtPDhU2Pbq3J", client.Pointer("123e4567-e89b-12d3-a456-426"))
if err != nil {
log.Fatal(err)
}
if res.RouteGetResponse != nil {
// handle response
}
}| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. | |
paymentID |
string |
✔️ | Provide the ID of the related payment. | tr_5B8cwPMGnU |
routeID |
string |
✔️ | Provide the ID of the route. | crt_dyARQ3JzCgtPDhU2Pbq3J |
idempotencyKey |
*string |
➖ | A unique key to ensure idempotent requests. This key should be a UUID v4 string. | 123e4567-e89b-12d3-a456-426 |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.PaymentGetRouteResponse, error
| Error Type | Status Code | Content Type |
|---|---|---|
| apierrors.ErrorResponse | 404 | application/hal+json |
| apierrors.APIError | 4XX, 5XX | */* |