{"modulePath":"github.com/hostinger/api-cli","version":"v1.2.0","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package payment_methods\n\n## Variables\n\n```go\nvar DeleteCmd = \u0026cobra.Command{\n\tUse:   \"delete \u003cpayment-method-id\u003e\",\n\tShort: \"Delete payment method\",\n\tLong:  \"Delete a payment method from your account.\\n\\nUse this endpoint to remove unused payment methods from user accounts.\",\n\tArgs:  cobra.MatchAll(cobra.ExactArgs(1)),\n\tRun: func(cmd *cobra.Command, args []string) {\n\t\tr, err := api.Request().BillingDeletePaymentMethodV1WithResponse(context.TODO(), utils.StringToInt(args[0]))\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\n\t\toutput.Format(cmd, r.Body, r.StatusCode())\n\t},\n}\n```\n\n```go\nvar GroupCmd = \u0026cobra.Command{\n\tUse:   \"payment-methods\",\n\tShort: \"Payment methods commands\",\n}\n```\n\n```go\nvar ListCmd = \u0026cobra.Command{\n\tUse:   \"list\",\n\tShort: \"Get payment method list\",\n\tLong:  \"Retrieve available payment methods that can be used for placing new orders.\\n\\nIf you want to add new payment method,\\nplease use [hPanel](https://hpanel.hostinger.com/billing/payment-methods).\\n\\nUse this endpoint to view available payment options before creating orders.\",\n\tRun: func(cmd *cobra.Command, args []string) {\n\t\tr, err := api.Request().BillingGetPaymentMethodListV1WithResponse(context.TODO())\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\n\t\toutput.Format(cmd, r.Body, r.StatusCode())\n\t},\n}\n```\n\n```go\nvar SetDefaultCmd = \u0026cobra.Command{\n\tUse:   \"set-default \u003cpayment-method-id\u003e\",\n\tShort: \"Set default payment method\",\n\tLong:  \"Set the default payment method for your account.\\n\\nUse this endpoint to configure the primary payment method for future orders.\",\n\tArgs:  cobra.MatchAll(cobra.ExactArgs(1)),\n\tRun: func(cmd *cobra.Command, args []string) {\n\t\tr, err := api.Request().BillingSetDefaultPaymentMethodV1WithResponse(context.TODO(), utils.StringToInt(args[0]))\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\n\t\toutput.Format(cmd, r.Body, r.StatusCode())\n\t},\n}\n```\n\n","path":"github.com/hostinger/api-cli/cmd/billing/payment_methods","name":"payment_methods","synopsis":"","isRedistributable":true}
