Checkout.com API

This service is used to create a payment, check webhook key, request a refund and manage user cards for checkout.com payment API

Register the service into your main.go file:

hitrixRegistry.ServiceProviderCheckout()
1

And you should put your credentials and other configs in config/hitrix.yml

checkout:
  secret_key: secret
  public_key: public
  currency: USD
  webhook_keys:
    main: somekey
1
2
3
4
5
6

Access the service:

checkoutService := service.DI().Checkout()
1

Using the service:

// Request a payment
checkoutService.RequestPayment(
    payments.IDSource{
        Type: "id",
        ID:  "sometoken",
    },
    100,
    "USD",
    "Order-1000",
    &payments.Customer{Email: "email@email.com"},
    map[string]string{"OrderId": "Order-1000"}
)
      
// Request a refund
checkoutService.RequestRefunds(1000, "PaymentId", "Order-1000", map[string]string{"OrderId": "Order-1000", "RefundsID": "Order-1000"})
      
// Validating incoming webhook
checkoutService.CheckWebhookKey("main", "value of Authorization header")

// Get user cards
checkoutService.GetCustomerInstruments("cus_someid")

// Delete user card
checkoutService.DeleteCustomerInstrument("src_someid")
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
Last Updated: 10/29/2021, 11:32:03 AM
Contributors: Iman Daneshi, Saman Shahroudi