0

I am using PHP to add Cards to a Customer

I have related questions so I have posted them together as (1)(2)(3)

I can use the balanced marketplace to verify that the customer has had each of the cards added to their account. I have no problem adding each card.

(1) When I use the following to get the customer object

$customer = \Balanced\Customer::get("/v1/customers/CU34xY6f9bKZzb0kjBxWTUjC");
var_dump($customer);

It only shows the second card added, however balanced marketplace lists both cards associated with the customer. Why is only one showing up in $customer?

(2) The var_dump($customer) gives "Balanced\Card" ["uri"]=> string(68) "/v1/customers/CU34xY6f9bKZzb0kjBxWTUjC/cards/CCyO8fJPHpaVzypm7L1TFbw" however the card uri is /v1/marketplaces/TEST-MP9COksoYlU4rwuakSzwYH6/cards/CCyO8fJPHpaVzypm7L1TFbw

Won't this lead to problems retrieving card info/charging cards?

(3) If I try to add either card again there is no change to $customer or the balanced marketplace. Should I be able to see some sort of error response, if so how? The documentation "https://docs.balancedpayments.com/1.0/api/customers/#adding-a-card-to-a-customer" gives an Example Response, I am assuming this is changes made to $customer as it does not say how you would view this response.

4

1 回答 1

1

您发布的两个 URI 都指向同一个 Card 资源,它们只是使用不同的 API 端点。

多次添加同一张卡不会导致错误。当您对卡进行标记(添加)时,会为提供的信息创建一个新的 Card 实例,并且您会返回一个唯一的 URI。每个 Card 实例只能与一个 Customer 关联。令牌化不会以这种方式检查“重复”卡,因为例如,一个人添加了他们的卡,然后他们的重要人物将其添加到另一个使用 Balanced 的服务中。您可以拥有信用卡的多个标记化表示,每个只能添加到一个客户,但代表同一张信用卡。

如果您对卡片进行标记并将其添加到 Customer,则 Customer 实例在其属性中反映新的 Card URI。您可能需要先重新加载 Customer 实例。如果您看到奇怪的行为,我建议您在 Freenode IRC 上使用#balanced,开发人员可以帮助您了解正在发生的事情。

于 2014-03-06T15:27:27.247 回答