## Hold a charge `client.Charges.Hold(ctx, id, params) (*ChargeV1, error)` **put** `/v1/charges/{id}/hold` Place a charge on hold to prevent it from being originated for processing. The status of the charge must be `created` or `scheduled`. ### Parameters - `id string` - `params ChargeHoldParams` - `Reason param.Field[string]` Body param: Details about why the charge status was updated. - `CorrelationID param.Field[string]` Header param: Optional client generated identifier to trace and debug a series of requests. - `IdempotencyKey param.Field[string]` Header param: Optional client generated value to use for idempotent requests. - `RequestID param.Field[string]` Header param: Optional client generated identifier to trace and debug a request. - `StraddleAccountID param.Field[string]` Header param: For use by platforms to specify an account id and set scope of a request. ### Returns - `type ChargeV1 struct{…}` - `Data ChargeV1Data` - `ID string` Unique identifier for the charge. - `Amount int64` The amount of the charge in cents. - `Config ChargeV1DataConfig` Configuration options for the charge. - `BalanceCheck string` Defines whether to check the customer's balance before processing the charge. - `const ChargeV1DataConfigBalanceCheckRequired ChargeV1DataConfigBalanceCheck = "required"` - `const ChargeV1DataConfigBalanceCheckEnabled ChargeV1DataConfigBalanceCheck = "enabled"` - `const ChargeV1DataConfigBalanceCheckDisabled ChargeV1DataConfigBalanceCheck = "disabled"` - `AutoHold bool` Defines whether to automatically place this charge on hold after being created. - `AutoHoldMessage string` The reason the charge is being automatically held on creation. - `SandboxOutcome string` Payment will simulate processing if not Standard. - `const ChargeV1DataConfigSandboxOutcomeStandard ChargeV1DataConfigSandboxOutcome = "standard"` - `const ChargeV1DataConfigSandboxOutcomePaid ChargeV1DataConfigSandboxOutcome = "paid"` - `const ChargeV1DataConfigSandboxOutcomeOnHoldDailyLimit ChargeV1DataConfigSandboxOutcome = "on_hold_daily_limit"` - `const ChargeV1DataConfigSandboxOutcomeCancelledForFraudRisk ChargeV1DataConfigSandboxOutcome = "cancelled_for_fraud_risk"` - `const ChargeV1DataConfigSandboxOutcomeCancelledForBalanceCheck ChargeV1DataConfigSandboxOutcome = "cancelled_for_balance_check"` - `const ChargeV1DataConfigSandboxOutcomeFailedInsufficientFunds ChargeV1DataConfigSandboxOutcome = "failed_insufficient_funds"` - `const ChargeV1DataConfigSandboxOutcomeReversedInsufficientFunds ChargeV1DataConfigSandboxOutcome = "reversed_insufficient_funds"` - `const ChargeV1DataConfigSandboxOutcomeFailedCustomerDispute ChargeV1DataConfigSandboxOutcome = "failed_customer_dispute"` - `const ChargeV1DataConfigSandboxOutcomeReversedCustomerDispute ChargeV1DataConfigSandboxOutcome = "reversed_customer_dispute"` - `const ChargeV1DataConfigSandboxOutcomeFailedClosedBankAccount ChargeV1DataConfigSandboxOutcome = "failed_closed_bank_account"` - `const ChargeV1DataConfigSandboxOutcomeReversedClosedBankAccount ChargeV1DataConfigSandboxOutcome = "reversed_closed_bank_account"` - `ConsentType string` The channel or mechanism through which the payment was authorized. Use `internet` for payments made online or through a mobile app and `signed` for signed agreements where there is a consent form or contract. Use `signed` for PDF signatures. - `const ChargeV1DataConsentTypeInternet ChargeV1DataConsentType = "internet"` - `const ChargeV1DataConsentTypeSigned ChargeV1DataConsentType = "signed"` - `CreatedAt Time` Timestamp of when the charge was created. - `Currency string` The currency of the charge. Only USD is supported. - `Description string` An arbitrary description for the charge. - `Device DeviceInfoV1` Information about the device used when the customer authorized the payment. - `IPAddress string` The IP address of the device used when the customer authorized the charge or payout. Use `0.0.0.0` to represent an offline consent interaction. - `ExternalID string` Unique identifier for the charge in your database. This value must be unique across all charges. - `FundingIDs []string` Funding Ids - `Paykey string` Value of the `paykey` used for the charge. - `PaymentDate Time` The desired date on which the payment should be occur. For charges, this means the date you want the customer to be debited on. - `Status string` The current status of the charge. - `const ChargeV1DataStatusCreated ChargeV1DataStatus = "created"` - `const ChargeV1DataStatusScheduled ChargeV1DataStatus = "scheduled"` - `const ChargeV1DataStatusFailed ChargeV1DataStatus = "failed"` - `const ChargeV1DataStatusCancelled ChargeV1DataStatus = "cancelled"` - `const ChargeV1DataStatusOnHold ChargeV1DataStatus = "on_hold"` - `const ChargeV1DataStatusPending ChargeV1DataStatus = "pending"` - `const ChargeV1DataStatusPaid ChargeV1DataStatus = "paid"` - `const ChargeV1DataStatusReversed ChargeV1DataStatus = "reversed"` - `const ChargeV1DataStatusValidating ChargeV1DataStatus = "validating"` - `StatusDetails StatusDetailsV1` Additional details about the current status of the charge. - `ChangedAt Time` The time the status change occurred. - `Message string` A human-readable description of the current status. - `Reason StatusDetailsV1Reason` A machine-readable identifier for the specific status, useful for programmatic handling. - `const StatusDetailsV1ReasonInsufficientFunds StatusDetailsV1Reason = "insufficient_funds"` - `const StatusDetailsV1ReasonClosedBankAccount StatusDetailsV1Reason = "closed_bank_account"` - `const StatusDetailsV1ReasonInvalidBankAccount StatusDetailsV1Reason = "invalid_bank_account"` - `const StatusDetailsV1ReasonInvalidRouting StatusDetailsV1Reason = "invalid_routing"` - `const StatusDetailsV1ReasonDisputed StatusDetailsV1Reason = "disputed"` - `const StatusDetailsV1ReasonPaymentStopped StatusDetailsV1Reason = "payment_stopped"` - `const StatusDetailsV1ReasonOwnerDeceased StatusDetailsV1Reason = "owner_deceased"` - `const StatusDetailsV1ReasonFrozenBankAccount StatusDetailsV1Reason = "frozen_bank_account"` - `const StatusDetailsV1ReasonRiskReview StatusDetailsV1Reason = "risk_review"` - `const StatusDetailsV1ReasonFraudulent StatusDetailsV1Reason = "fraudulent"` - `const StatusDetailsV1ReasonDuplicateEntry StatusDetailsV1Reason = "duplicate_entry"` - `const StatusDetailsV1ReasonInvalidPaykey StatusDetailsV1Reason = "invalid_paykey"` - `const StatusDetailsV1ReasonPaymentBlocked StatusDetailsV1Reason = "payment_blocked"` - `const StatusDetailsV1ReasonAmountTooLarge StatusDetailsV1Reason = "amount_too_large"` - `const StatusDetailsV1ReasonTooManyAttempts StatusDetailsV1Reason = "too_many_attempts"` - `const StatusDetailsV1ReasonInternalSystemError StatusDetailsV1Reason = "internal_system_error"` - `const StatusDetailsV1ReasonUserRequest StatusDetailsV1Reason = "user_request"` - `const StatusDetailsV1ReasonOk StatusDetailsV1Reason = "ok"` - `const StatusDetailsV1ReasonOtherNetworkReturn StatusDetailsV1Reason = "other_network_return"` - `const StatusDetailsV1ReasonPayoutRefused StatusDetailsV1Reason = "payout_refused"` - `const StatusDetailsV1ReasonCancelRequest StatusDetailsV1Reason = "cancel_request"` - `const StatusDetailsV1ReasonFailedVerification StatusDetailsV1Reason = "failed_verification"` - `const StatusDetailsV1ReasonRequireReview StatusDetailsV1Reason = "require_review"` - `const StatusDetailsV1ReasonBlockedBySystem StatusDetailsV1Reason = "blocked_by_system"` - `const StatusDetailsV1ReasonWatchtowerReview StatusDetailsV1Reason = "watchtower_review"` - `const StatusDetailsV1ReasonValidating StatusDetailsV1Reason = "validating"` - `const StatusDetailsV1ReasonAutoHold StatusDetailsV1Reason = "auto_hold"` - `Source StatusDetailsV1Source` Identifies the origin of the status change (e.g., `bank_decline`, `watchtower`). This helps in tracking the cause of status updates. - `const StatusDetailsV1SourceWatchtower StatusDetailsV1Source = "watchtower"` - `const StatusDetailsV1SourceBankDecline StatusDetailsV1Source = "bank_decline"` - `const StatusDetailsV1SourceCustomerDispute StatusDetailsV1Source = "customer_dispute"` - `const StatusDetailsV1SourceUserAction StatusDetailsV1Source = "user_action"` - `const StatusDetailsV1SourceSystem StatusDetailsV1Source = "system"` - `Code string` The status code if applicable. - `StatusHistory []ChargeV1DataStatusHistory` Status history. - `ChangedAt Time` The time the status change occurred. - `Message string` A human-readable description of the status. - `Reason string` A machine-readable identifier for the specific status, useful for programmatic handling. - `const ChargeV1DataStatusHistoryReasonInsufficientFunds ChargeV1DataStatusHistoryReason = "insufficient_funds"` - `const ChargeV1DataStatusHistoryReasonClosedBankAccount ChargeV1DataStatusHistoryReason = "closed_bank_account"` - `const ChargeV1DataStatusHistoryReasonInvalidBankAccount ChargeV1DataStatusHistoryReason = "invalid_bank_account"` - `const ChargeV1DataStatusHistoryReasonInvalidRouting ChargeV1DataStatusHistoryReason = "invalid_routing"` - `const ChargeV1DataStatusHistoryReasonDisputed ChargeV1DataStatusHistoryReason = "disputed"` - `const ChargeV1DataStatusHistoryReasonPaymentStopped ChargeV1DataStatusHistoryReason = "payment_stopped"` - `const ChargeV1DataStatusHistoryReasonOwnerDeceased ChargeV1DataStatusHistoryReason = "owner_deceased"` - `const ChargeV1DataStatusHistoryReasonFrozenBankAccount ChargeV1DataStatusHistoryReason = "frozen_bank_account"` - `const ChargeV1DataStatusHistoryReasonRiskReview ChargeV1DataStatusHistoryReason = "risk_review"` - `const ChargeV1DataStatusHistoryReasonFraudulent ChargeV1DataStatusHistoryReason = "fraudulent"` - `const ChargeV1DataStatusHistoryReasonDuplicateEntry ChargeV1DataStatusHistoryReason = "duplicate_entry"` - `const ChargeV1DataStatusHistoryReasonInvalidPaykey ChargeV1DataStatusHistoryReason = "invalid_paykey"` - `const ChargeV1DataStatusHistoryReasonPaymentBlocked ChargeV1DataStatusHistoryReason = "payment_blocked"` - `const ChargeV1DataStatusHistoryReasonAmountTooLarge ChargeV1DataStatusHistoryReason = "amount_too_large"` - `const ChargeV1DataStatusHistoryReasonTooManyAttempts ChargeV1DataStatusHistoryReason = "too_many_attempts"` - `const ChargeV1DataStatusHistoryReasonInternalSystemError ChargeV1DataStatusHistoryReason = "internal_system_error"` - `const ChargeV1DataStatusHistoryReasonUserRequest ChargeV1DataStatusHistoryReason = "user_request"` - `const ChargeV1DataStatusHistoryReasonOk ChargeV1DataStatusHistoryReason = "ok"` - `const ChargeV1DataStatusHistoryReasonOtherNetworkReturn ChargeV1DataStatusHistoryReason = "other_network_return"` - `const ChargeV1DataStatusHistoryReasonPayoutRefused ChargeV1DataStatusHistoryReason = "payout_refused"` - `const ChargeV1DataStatusHistoryReasonCancelRequest ChargeV1DataStatusHistoryReason = "cancel_request"` - `const ChargeV1DataStatusHistoryReasonFailedVerification ChargeV1DataStatusHistoryReason = "failed_verification"` - `const ChargeV1DataStatusHistoryReasonRequireReview ChargeV1DataStatusHistoryReason = "require_review"` - `const ChargeV1DataStatusHistoryReasonBlockedBySystem ChargeV1DataStatusHistoryReason = "blocked_by_system"` - `const ChargeV1DataStatusHistoryReasonWatchtowerReview ChargeV1DataStatusHistoryReason = "watchtower_review"` - `const ChargeV1DataStatusHistoryReasonValidating ChargeV1DataStatusHistoryReason = "validating"` - `const ChargeV1DataStatusHistoryReasonAutoHold ChargeV1DataStatusHistoryReason = "auto_hold"` - `Source string` Identifies the origin of the status change (e.g., `bank_decline`, `watchtower`). This helps in tracking the cause of status updates. - `const ChargeV1DataStatusHistorySourceWatchtower ChargeV1DataStatusHistorySource = "watchtower"` - `const ChargeV1DataStatusHistorySourceBankDecline ChargeV1DataStatusHistorySource = "bank_decline"` - `const ChargeV1DataStatusHistorySourceCustomerDispute ChargeV1DataStatusHistorySource = "customer_dispute"` - `const ChargeV1DataStatusHistorySourceUserAction ChargeV1DataStatusHistorySource = "user_action"` - `const ChargeV1DataStatusHistorySourceSystem ChargeV1DataStatusHistorySource = "system"` - `Status string` The current status of the `charge` or `payout`. - `const ChargeV1DataStatusHistoryStatusCreated ChargeV1DataStatusHistoryStatus = "created"` - `const ChargeV1DataStatusHistoryStatusScheduled ChargeV1DataStatusHistoryStatus = "scheduled"` - `const ChargeV1DataStatusHistoryStatusFailed ChargeV1DataStatusHistoryStatus = "failed"` - `const ChargeV1DataStatusHistoryStatusCancelled ChargeV1DataStatusHistoryStatus = "cancelled"` - `const ChargeV1DataStatusHistoryStatusOnHold ChargeV1DataStatusHistoryStatus = "on_hold"` - `const ChargeV1DataStatusHistoryStatusPending ChargeV1DataStatusHistoryStatus = "pending"` - `const ChargeV1DataStatusHistoryStatusPaid ChargeV1DataStatusHistoryStatus = "paid"` - `const ChargeV1DataStatusHistoryStatusReversed ChargeV1DataStatusHistoryStatus = "reversed"` - `const ChargeV1DataStatusHistoryStatusValidating ChargeV1DataStatusHistoryStatus = "validating"` - `Code string` The status code if applicable. - `TraceIDs map[string, string]` Trace Ids. - `UpdatedAt Time` Timestamp of when the charge was last updated. - `CustomerDetails CustomerDetailsV1` Information about the customer associated with the charge. - `ID string` Unique identifier for the customer - `CustomerType CustomerDetailsV1CustomerType` The type of customer - `const CustomerDetailsV1CustomerTypeIndividual CustomerDetailsV1CustomerType = "individual"` - `const CustomerDetailsV1CustomerTypeBusiness CustomerDetailsV1CustomerType = "business"` - `Email string` The customer's email address - `Name string` The name of the customer - `Phone string` The customer's phone number in E.164 format - `EffectiveAt Time` Timestamp of when the charge was effective in the customer's bank account, otherwise known as the date on which the customer is debited. - `Metadata map[string, string]` Up to 20 additional user-defined key-value pairs. Useful for storing additional information about the charge in a structured format. - `PaykeyDetails PaykeyDetailsV1` Information about the paykey used for the charge. - `ID string` Unique identifier for the paykey. - `CustomerID string` Unique identifier for the customer associated with the paykey. - `Label string` Human-readable label that combines the bank name and masked account number to help easility represent this paykey in a UI - `Balance int64` The most recent balance of the bank account associated with the paykey in dollars. - `PaymentRail string` The payment rail that the charge will be processed through. - `const ChargeV1DataPaymentRailACH ChargeV1DataPaymentRail = "ach"` - `ProcessedAt Time` Timestamp of when the charge was processed by Straddle and originated to the payment rail. - `RelatedPayments map[string, string]` Related payments. - `const ChargeV1DataRelatedPaymentOriginal ChargeV1DataRelatedPayment = "original"` - `const ChargeV1DataRelatedPaymentResubmit ChargeV1DataRelatedPayment = "resubmit"` - `const ChargeV1DataRelatedPaymentRefund ChargeV1DataRelatedPayment = "refund"` - `Meta ResponseMetadata` Metadata about the API request, including an identifier and timestamp. - `APIRequestID string` Unique identifier for this API request, useful for troubleshooting. - `APIRequestTimestamp Time` Timestamp for this API request, useful for troubleshooting. - `ResponseType ChargeV1ResponseType` Indicates the structure of the returned content. - "object" means the `data` field contains a single JSON object. - "array" means the `data` field contains an array of objects. - "error" means the `data` field contains an error object with details of the issue. - "none" means no data is returned. - `const ChargeV1ResponseTypeObject ChargeV1ResponseType = "object"` - `const ChargeV1ResponseTypeArray ChargeV1ResponseType = "array"` - `const ChargeV1ResponseTypeError ChargeV1ResponseType = "error"` - `const ChargeV1ResponseTypeNone ChargeV1ResponseType = "none"` ### Example ```go package main import ( "context" "fmt" "github.com/straddleio/straddle-go" "github.com/straddleio/straddle-go/option" ) func main() { client := straddle.NewClient( option.WithAPIKey("My API Key"), ) chargeV1, err := client.Charges.Hold( context.TODO(), "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", straddle.ChargeHoldParams{ }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", chargeV1.Data) } ``` #### Response ```json { "data": { "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "amount": 10000, "config": { "balance_check": "required", "auto_hold": true, "auto_hold_message": "auto_hold_message", "sandbox_outcome": "standard" }, "consent_type": "internet", "created_at": "2019-12-27T18:11:19.117Z", "currency": "currency", "description": "Monthly subscription fee", "device": { "ip_address": "192.168.1.1" }, "external_id": "external_id", "funding_ids": [ "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e" ], "paykey": "paykey", "payment_date": "2019-12-27", "status": "created", "status_details": { "changed_at": "2019-12-27T18:11:19.117Z", "message": "Payment successfully created and awaiting validation.", "reason": "insufficient_funds", "source": "system", "code": null }, "status_history": [ { "changed_at": "2019-12-27T18:11:19.117Z", "message": "Payment successfully created and awaiting validation.", "reason": "insufficient_funds", "source": "watchtower", "status": "created", "code": null } ], "trace_ids": { "foo": "string" }, "updated_at": "2019-12-27T18:11:19.117Z", "customer_details": { "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "customer_type": "individual", "email": "ron@swanson.com", "name": "Ron Swanson", "phone": "+1234567890" }, "effective_at": "2019-12-27T18:11:19.117Z", "metadata": { "foo": "string" }, "paykey_details": { "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "customer_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "label": "Bank of America ****1234", "balance": 0 }, "payment_rail": "ach", "processed_at": "2019-12-27T18:11:19.117Z", "related_payments": { "foo": "original" } }, "meta": { "api_request_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "api_request_timestamp": "2019-12-27T18:11:19.117Z" }, "response_type": "object" } ```