如何在Cyber​​source REST API中指定设备指纹ID?

时间:2018-12-19 15:18:59

标签: python rest payment cybersource

我正在尝试将Cyber​​Source的REST API集成到Django(Python)应用程序中。我正在关注这个GitHub example示例。 它的工作原理就像一个咒语,但是从示例或documentation的角度来看我还是不清楚如何指定设备的指纹ID。

这是我发送的请求的摘要,以防它有用(注意:这只是一种位于POPO内的方法):

def authorize_payment(self, card_token: str, total_amount: Money, customer: CustomerInformation = None,
                      merchant: MerchantInformation = None):
    try:
        request = {
            'payment_information': {
                # NOTE: REQUIRED.
                'card': None,
                'tokenized_card': None,
                'customer': {
                    'customer_id': card_token,
                },
            },
            'order_information': {
                'amount_details': {
                    'total_amount': str(total_amount.amount),
                    'currency': str(total_amount.currency),
                },
            },
        }

        if customer:
            request['order_information'].update({
                'bill_to': {
                    'first_name': customer.first_name,
                    'last_name': customer.last_name,
                    'company': customer.company,
                    'address1': customer.address1,
                    'address2': customer.address2,
                    'locality': customer.locality,
                    'country': customer.country,
                    'email': customer.email,
                    'phone_number': customer.phone_number,
                    'administrative_area': customer.administrative_area,
                    'postalCode': customer.zip_code,
                }
            })

        serialized_request = json.dumps(request)
        data, status, body = self._payment_api_client.create_payment(create_payment_request=serialized_request)

        return data.id
    except Exception as e:
        raise AuthorizePaymentError from e

0 个答案:

没有答案