Purchasing...Ops! (The worst case analysis: card declined!)

2 minutes
Share the link to this page
Copied
  Completed
You need to have access to the item to view this lesson.
One-time Fee
$49.99
List Price:  $69.99
You save:  $20
€42.37
List Price:  €59.33
You save:  €16.95
£36.98
List Price:  £51.77
You save:  £14.79
CA$68.34
List Price:  CA$95.69
You save:  CA$27.34
A$74.46
List Price:  A$104.26
You save:  A$29.79
S$64.16
List Price:  S$89.83
You save:  S$25.66
HK$388.67
List Price:  HK$544.17
You save:  HK$155.50
CHF 39.33
List Price:  CHF 55.07
You save:  CHF 15.73
NOK kr499.75
List Price:  NOK kr699.69
You save:  NOK kr199.94
DKK kr316.53
List Price:  DKK kr443.17
You save:  DKK kr126.63
NZ$85.50
List Price:  NZ$119.71
You save:  NZ$34.20
د.إ183.58
List Price:  د.إ257.03
You save:  د.إ73.45
৳6,103.48
List Price:  ৳8,545.36
You save:  ৳2,441.88
₹4,487.35
List Price:  ₹6,282.65
You save:  ₹1,795.29
RM202.45
List Price:  RM283.45
You save:  RM81
₦72,654.46
List Price:  ₦101,722.06
You save:  ₦29,067.60
₨13,991.71
List Price:  ₨19,589.52
You save:  ₨5,597.80
฿1,551.70
List Price:  ฿2,172.50
You save:  ฿620.80
₺2,142.08
List Price:  ₺2,999.09
You save:  ₺857
B$275.89
List Price:  B$386.27
You save:  B$110.38
R830.94
List Price:  R1,163.39
You save:  R332.44
Лв82.91
List Price:  Лв116.09
You save:  Лв33.17
₩72,443.01
List Price:  ₩101,426.02
You save:  ₩28,983
₪158.95
List Price:  ₪222.55
You save:  ₪63.59
₱2,935.06
List Price:  ₱4,109.32
You save:  ₱1,174.26
¥7,795.24
List Price:  ¥10,913.96
You save:  ¥3,118.72
MX$894.24
List Price:  MX$1,252.01
You save:  MX$357.76
QR182.56
List Price:  QR255.60
You save:  QR73.04
P657.43
List Price:  P920.46
You save:  P263.02
KSh6,443.71
List Price:  KSh9,021.71
You save:  KSh2,578
E£2,378.76
List Price:  E£3,330.46
You save:  E£951.69
ብር7,782
List Price:  ብር10,895.42
You save:  ብር3,113.42
Kz45,605.18
List Price:  Kz63,850.90
You save:  Kz18,245.72
CLP$45,200.45
List Price:  CLP$63,284.25
You save:  CLP$18,083.80
CN¥350.64
List Price:  CN¥490.93
You save:  CN¥140.28
RD$3,116.95
List Price:  RD$4,363.98
You save:  RD$1,247.03
DA6,469.67
List Price:  DA9,058.05
You save:  DA2,588.38
FJ$113.43
List Price:  FJ$158.82
You save:  FJ$45.38
Q382.66
List Price:  Q535.76
You save:  Q153.09
GY$10,449.68
List Price:  GY$14,630.39
You save:  GY$4,180.70
ISK kr6,271.74
List Price:  ISK kr8,780.94
You save:  ISK kr2,509.20
DH455.56
List Price:  DH637.83
You save:  DH182.26
L840.55
List Price:  L1,176.84
You save:  L336.28
ден2,607.95
List Price:  ден3,651.34
You save:  ден1,043.39
MOP$400.15
List Price:  MOP$560.24
You save:  MOP$160.09
N$833.77
List Price:  N$1,167.35
You save:  N$333.57
C$1,838.15
List Price:  C$2,573.56
You save:  C$735.41
रु7,168.09
List Price:  रु10,035.91
You save:  रु2,867.81
S/168.12
List Price:  S/235.38
You save:  S/67.26
K212.58
List Price:  K297.63
You save:  K85.05
SAR187.49
List Price:  SAR262.50
You save:  SAR75.01
ZK1,128.80
List Price:  ZK1,580.42
You save:  ZK451.61
L215.65
List Price:  L301.92
You save:  L86.27
Kč1,028.52
List Price:  Kč1,440.02
You save:  Kč411.49
Ft16,496.46
List Price:  Ft23,096.37
You save:  Ft6,599.90
SEK kr458.14
List Price:  SEK kr641.43
You save:  SEK kr183.29
ARS$72,508.96
List Price:  ARS$101,518.34
You save:  ARS$29,009.38
Bs346.51
List Price:  Bs485.14
You save:  Bs138.63
COP$189,566.44
List Price:  COP$265,408.19
You save:  COP$75,841.74
₡24,712.81
List Price:  ₡34,599.91
You save:  ₡9,887.10
L1,316.60
List Price:  L1,843.35
You save:  L526.74
₲340,319.56
List Price:  ₲476,474.61
You save:  ₲136,155.05
$U1,953.82
List Price:  $U2,735.50
You save:  $U781.68
zł178.46
List Price:  zł249.86
You save:  zł71.40
Already have an account? Log In

Transcript

Okay, now, it's time to give the user a feedback about the purchase operation that we are going to do using stripe. So we already set up the pay with token function, the pay with token method that is calling the e commerce API's through stripe pay with token that it's defined in this way. So we reject an error in case of error. And we are going to analyze the worst case first. So the error that you want that we want to display to the user. So if you remember, we already set the purchase error and purchase error message state variable according to the error message.

So it's time to show this feedback to the user. So what we can do is to use the alert component we are going to say that the collar would be a warning and it accepts the easel pen Param that is for in our case is the Portuguese error state variable and it accepts even a toggle that is defined as the this one error message toggle that basically just toggle the value of the purchaser or state variable and we are going to show inside this alert the poor chase error my such That we import again here our UI again, let's go to buy this pair of shoes. And we want to try with a card declined error just to see if our feedback works fine. So going to the testing cards section of stripe documentation, we can search for decline. And we can, for example, take this one and we can try with some other value and we do the pay now.

We click the Pay Now button and here are our feedback. Your card was declined

Sign Up

Share

Share with friends, get 20% off
Invite your friends to LearnDesk learning marketplace. For each purchase they make, you get 20% off (upto $10) on your next purchase.