質問編集履歴
1
最後に、dataオプションを変更したコードを追記
test
CHANGED
File without changes
|
test
CHANGED
@@ -155,3 +155,77 @@
|
|
155
155
|
|
156
156
|
|
157
157
|
```
|
158
|
+
|
159
|
+
|
160
|
+
|
161
|
+
追記
|
162
|
+
|
163
|
+
|
164
|
+
|
165
|
+
```
|
166
|
+
|
167
|
+
var app = new Vue({
|
168
|
+
|
169
|
+
el: "#app",
|
170
|
+
|
171
|
+
data: {
|
172
|
+
|
173
|
+
card: {
|
174
|
+
|
175
|
+
number: "",
|
176
|
+
|
177
|
+
cvc: "",
|
178
|
+
|
179
|
+
exp_month: "",
|
180
|
+
|
181
|
+
exp_year: "",
|
182
|
+
|
183
|
+
}
|
184
|
+
|
185
|
+
},
|
186
|
+
|
187
|
+
methods: {
|
188
|
+
|
189
|
+
addCard: function(event) {
|
190
|
+
|
191
|
+
Payjp.createToken(this.card, (status, response) => {
|
192
|
+
|
193
|
+
debugger
|
194
|
+
|
195
|
+
if (status == 200) {
|
196
|
+
|
197
|
+
this.number = ""
|
198
|
+
|
199
|
+
this.cvc = ""
|
200
|
+
|
201
|
+
this.exp_month = ""
|
202
|
+
|
203
|
+
this.exp_year = ""
|
204
|
+
|
205
|
+
$("#card_token").append(
|
206
|
+
|
207
|
+
$('<input type="hidden" name="payjpToken">').val(response.id)
|
208
|
+
|
209
|
+
);
|
210
|
+
|
211
|
+
document.chargeForm.submit()
|
212
|
+
|
213
|
+
alert("登録が完了しました")
|
214
|
+
|
215
|
+
} else {
|
216
|
+
|
217
|
+
alert("カード情報が不正です")
|
218
|
+
|
219
|
+
}
|
220
|
+
|
221
|
+
})
|
222
|
+
|
223
|
+
}
|
224
|
+
|
225
|
+
}
|
226
|
+
|
227
|
+
})
|
228
|
+
|
229
|
+
|
230
|
+
|
231
|
+
```
|