最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

python - authorize.net authOnlyTransaction immediately charges customer's card - Stack Overflow

programmeradmin3浏览0评论

I'm trying to implement a deferred payment system using authorize's "Authorize a Credit Card" (authorize) and "Capture a Previously Authorized Amount" (capture) functionalities with the following transaction types:

  • Authorization: authOnlyTransaction
  • Capture: priorAuthCaptureTransaction

My plan is for the authorization step to place a hold on the funds without immediately charging the card, and then to process and record the charge only when the capture is executed within the 30-day validity period.

However, I’ve noticed that as soon as I call the authorize endpoint, the issuing bank immediately processes the charge and the transaction appears in the billing records—even though I haven't executed a capture yet. When I subsequently void the transaction, it refunds an already processed payment.

Could there be any account settings or API configuration issues causing the authorization to finalize the charge immediately? How can I adjust my implementation so that the charge occurs only when the capture is executed?

Any insights or suggestions would be greatly appreciated.

    class TransactionType(Enum):
        AUTH_ONLY = "authOnlyTransaction"
        PRIOR_AUTH_CAPTURE = "priorAuthCaptureTransaction"

    @classmethod
    def _set_transaction_info(
        cls,
        db: Session,
        dto: ProcessPaymentDTO,
        transaction_type: TransactionType,
    ):
        ...

        transaction_request = apicontractsv1.transactionRequestType()
        transaction_request.transactionType = transaction_type.value

    @classmethod
    def authorize_credit_card(
        cls,
        auth: AuthHeader
        db: Session,
        dto: AuthorizedPaymentDTO,
    ) -> ProcessPaymentResponse:
        try:
            txDto = cls._set_transaction_info(
                db=db,
                dto=dto,
                transaction_type=TransactionType.AUTH_ONLY,
            )
            ctrl = createTransactionController(txDto)
            ctrl.setenvironment(constants.constants.PRODUCTION)
            ctrl.execute()

            response: apicontractsv1.createTransactionResponse = ctrl.getresponse()```
发布评论

评论列表(0)

  1. 暂无评论