braintree 업데이트 방법을 사용하여 프로젝트에서 사용자의 신용 카드 정보를 업데이트해야합니다.사용자의 카드 번호없이 braintree 업데이트 방법을 사용하여 신용 카드 정보를 업데이트 할 수 있습니까?
카드의 그 갱신에 대한 내 컨트롤러의 코드 세그먼트는 다음과 같습니다 -
case 'update':
$expirationMonth = $this->input->post('expiration_month');
$expirationYear = $this->input->post('expiration_year');
if (!empty($expirationMonth) && !empty($expirationYear)) {
if (date('Y') > $expirationYear) {
die('expired');
} else if ($expirationYear == date('Y')) {
if (date('m') > $expirationMonth)
die('expired');
}
}
$cardId = $this->input->post('cardId');
$cardNumber = $this->input->post('card_num');
$streetAddress = $this->input->post('street_add');
$cardCity = $this->input->post('card_city');
$cardState = $this->input->post('card_state');
$postalCode = $this->input->post('postal_code');
$customerId = $this->input->post('customer_id');
$vaultToken = $this->input->post('vault_token');
$cvvCode = $this->input->post('cvv_code');
$data['default_status'] = $this->input->post('default_status');
$data['card_type'] = $this->input->post('cardType');
$this->load->library("braintreelib");
$result = Braintree_Customer::update($customerId, array(
//we can create a credit card at the same time
'creditCard' => array(
//'cardholderName' => $this->input->post('cardholder_name'),
//'number' => $cardNumber,
'expirationMonth' => $expirationMonth,
'expirationYear' => $expirationYear,
'cvv' => $cvvCode,
'billingAddress' => array(
/* Optional Information you can supply */
'streetAddress' => $streetAddress,
'locality' => $cardCity,
'region' => getUsStateName($cardState)->abbrev,
'postalCode' => $postalCode,
),
'options' => array('verifyCard' => true)
)
));
if (isset($cardId)) {
if($result->success){
$this->load->model('updatedetails_model');
if($data['default_status']){
$this->common->saveDetails(TBL_RS_PAYMENTDETAILS, array('default_status' => 0, 'card_type' => $cardType), array('currentuserid' => $currentUserId, 'currentroleid' => $this->input->post('roleId')));
}
$cardDetailId = $this->updatedetails_model->addedit_carddetails($data, $cardId);
if (!$cardDetailId) {
echo 'error';
exit;
}
}else{
foreach ($result->errors->deepAll() as $error) {
$errorFound = $error->message . "<br />";
}
//echo $errorFound ;
echo $errorFound;
exit;
}
} else {
echo 'invalidcarddetails';
exit;
}
$details['carddetails'] = $this->profile->getUserCardDetailsByUserId($currentUserId);
foreach($details['carddetails'] as $index => $value){
$paymentMethod = Braintree_PaymentMethod::find(base64_decode($value->vault_token));
$details['carddetails'][$index]->lastDigit = $paymentMethod->last4;
$details['carddetails'][$index]->cardType = $paymentMethod->cardType;
$details['carddetails'][$index]->cardholderName = ucfirst($paymentMethod->cardholderName);
}
$this->data['carddetails'] = $details['carddetails'];
echo $b = $this->load->view('operatorCardListing', $this->data, TRUE);
break;
나는이 코드를 실행하려고, 난 오류가 무엇입니까 -
신용 카드 번호를 포함해야합니다 , paymentMethodNonce 또는 venmoSdkPaymentMethodCode.
내 요구 사항은 카드 번호를 입력하지 않고 신용 카드 정보를 업데이트하는 것입니다.
신용 카드 번호없이 카드를 업데이트 할 수 있습니까?
구체적으로 업데이트하려는 특정 지불 방법은 무엇입니까? – ThinkAboutIt
번호가없는 카드로 클라이언트 카드를 업데이트하려고합니까? 가능한 경우 생각하지 않으므로 장바구니를 추가하면 기본적으로 확인됩니다. 카드를 지우지 않는 이유는 무엇입니까? –