account.number 是必需的(循环)
account.number is required (recurly)
我正在尝试使用他们的 python API 创建一个 Recurly 帐户,并不断遇到同样的错误:
def upsert_recurly_account(office):
try:
account = recurly.Account.get(office.pk)
except recurly.errors.NotFoundError:
logger.warning("Creating new recurly account for pk %s" % office.pk)
account = recurly.Account(account_code=office.pk)
else:
logger.info("Recurly account %s already exists, we will update it")
account.email = office.manager.email
account.first_name = office.manager.first_name
account.last_name = office.manager.last_name
account.company_name = '%s - %s' % (office.legal_name, office.name)
account.vat_number = office.tax_id
account.tax_exempt = office.tax_exempt
billing_info = recurly.BillingInfo()
billing_info.first_name = office.manager.first_name
billing_info.last_name = office.manager.last_name
billing_info.address1 = office.address1
billing_info.address2 = office.address2
billing_info.city = office.city
billing_info.country = office.country
billing_info.zip = office.postal_code
billing_info.phone = office.phone
billing_info.vat_number = office.tax_id
account.billing_info = billing_info
account.save()
我得到的错误是:
ValidationError:required: account.number is required
手动添加
account.number = 1234
没有解决问题。
有什么想法吗?
Account.number 不是有效的 Recurly 字段 - 看起来您需要通过 account_code - 请参阅 https://docs.recurly.com/api/accounts#create-account
处的示例
由于您要创建一个包含嵌套账单信息的新帐户,因此您需要在 billing_info
哈希中提供有效的信用卡号,如下所示:
billing_info.number = 123
创建带有嵌套结算信息的新帐户时,还有其他必填字段(如 month
和 year
)。请阅读the docs
我正在尝试使用他们的 python API 创建一个 Recurly 帐户,并不断遇到同样的错误:
def upsert_recurly_account(office):
try:
account = recurly.Account.get(office.pk)
except recurly.errors.NotFoundError:
logger.warning("Creating new recurly account for pk %s" % office.pk)
account = recurly.Account(account_code=office.pk)
else:
logger.info("Recurly account %s already exists, we will update it")
account.email = office.manager.email
account.first_name = office.manager.first_name
account.last_name = office.manager.last_name
account.company_name = '%s - %s' % (office.legal_name, office.name)
account.vat_number = office.tax_id
account.tax_exempt = office.tax_exempt
billing_info = recurly.BillingInfo()
billing_info.first_name = office.manager.first_name
billing_info.last_name = office.manager.last_name
billing_info.address1 = office.address1
billing_info.address2 = office.address2
billing_info.city = office.city
billing_info.country = office.country
billing_info.zip = office.postal_code
billing_info.phone = office.phone
billing_info.vat_number = office.tax_id
account.billing_info = billing_info
account.save()
我得到的错误是:
ValidationError:required: account.number is required
手动添加
account.number = 1234
没有解决问题。
有什么想法吗?
Account.number 不是有效的 Recurly 字段 - 看起来您需要通过 account_code - 请参阅 https://docs.recurly.com/api/accounts#create-account
处的示例由于您要创建一个包含嵌套账单信息的新帐户,因此您需要在 billing_info
哈希中提供有效的信用卡号,如下所示:
billing_info.number = 123
创建带有嵌套结算信息的新帐户时,还有其他必填字段(如 month
和 year
)。请阅读the docs